Jump to content
Software FX Community

Adding Data to real time charts


User (Legacy)

Recommended Posts

Hi, 

I am using the ChartFX 98 component in Visual C++. I am having problems

adding data using the series object but it works fine using ValueEx

property. Also, I can't seem to align my scrollbar to display the last

point that was added to the chart. In the code below I have included the

calls I am making when I am trying to align the scrollbar.

Help is greatly appreciated.

Here is my code:

This works..........

//add one point from the right in realtime for each series

m_spChartFX->OpenDataEx((CfxCod) (COD_VALUES | COD_ADDPOINTS), m_numSeries,

1);

for (short i = 0; i < m_numSeries; i++) {

m_spChartFX->ValueEx[i][0] = rand() % 100;

}

// Closing the data channel using COD_SMOOTH will stop screen flickering

m_spChartFX->CloseData((CfxCod) (COD_VALUES | COD_REALTIME | COD_SMOOTH |

COD_REALTIMESCROLL));

m_spChartFX->Scroll(CSB_RIGHT, 0);

This does not work.....

ICfxSeriesEnumPtr seriesEnumPtr = m_spChartFX->GetSeries();

//add one point from the right in realtime for each series

m_spChartFX->OpenDataEx((CfxCod) (COD_VALUES | COD_ADDPOINTS), m_numSeries,

1);

for (short i = 0; i < m_numSeries; i++) {

ICfxSeriesPtr seriesPtr = seriesEnumPtr->GetItem(i);

seriesPtr->PutYvalue(0, rand() % 100);

//m_spChartFX->Series->Item[m_traceVariables[i]->item]->PutYvalue(0,

rand() % 100);

}

// Closing the data channel using COD_SMOOTH will stop screen flickering

m_spChartFX->CloseData((CfxCod) (COD_VALUES | COD_REALTIME | COD_SMOOTH |

COD_REALTIMESCROLL));

m_spChartFX->Scroll(CSB_RIGHT, 0);

Thanks

Frank Cammaroto

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...