Looking at your project, there are two issues that I see. The first is this:
for(;;)
{
m_graph.Plots.Item(1).ChartXY(time, voltage);
m_graph.Plots.Item(2).ChartXY(time, current);
time++;
}
This is charting data in a very tight, endless loop. You'll notice that not only is the graph not updating, the entire application is not responding. This is because the application is not getting a chance to process windows messages, hence the UI does not get a chance to update. If you want to chart data continuously like this, you will need to either do it on a timer or pump messages somewhere in your loop so Windows messages can be processed.
We can temporarily work around this problem f
or demonstration purposes by changing the OnStart method like this:
void CTestDlg::OnStart()
{
static double time = 0;
double voltage = 2.5;
double current = -10;
// for(;;)
// {
m_graph.Plots.Item(1).ChartXY(time, voltage);
m_graph.Plots.Item(2).ChartXY(time, current);
time++;
// }
}
The intent of this change is that we can click the Start button and data will be added every time that we click. Now if you run the application, you'll notice that there's only one plot displayed. This is because the Y axes are a fixed scale from 0 to 10, but your plot that's displaying current (the second plot) is charting data that's out of range. You can fix this by either adjusting the fixed range of the Y axis that's associated with the current plot, or you can configure it to auto scale.
Hope this helps.
- Elton