一个非常好用的MFC 曲线控件
在CDialog.h中定义控件
CChartCtrl m_cChartFx;
在CDialog.cpp中
绑定控件
DDX_Control(pDX, IDC_STATIC_FY, m_cChartFy);
初始化控件
CChartAxis *pAxis = NULL;
pAxis = m_cChartFx.CreateStandardAxis(CChartCtrl::BottomAxis);
pAxis->SetAutomatic(true);
pAxis = m_cChartFx.CreateStandardAxis(CChartCtrl::LeftAxis);
pAxis->SetAutomatic(true);
m_cChartFx.GetTitle()->AddString(L"value_FX ");
m_cChartFx.GetLeftAxis()->GetLabel()->SetText(L"单位:N");
m_cChartFx.GetBottomAxis()->GetLabel()->SetText(L"单位时间");
m_cChartFx.EnableRefresh(false);
m_cChartFx.RemoveAllSeries();//先清空
pLineSerie1Fx = m_cChartFx.CreateLineSerie(); //创建一个曲线
m_cChartFx.EnableRefresh(true);
m_cChartFx.SetBackColor(RGB(200, 200, 200));
pLineSerie1Fx->AddPoints(x, theApp.m_SaveDataFy, theApp.m_index); //画数据点
1