Page 1 of 1

Problem with FastLineSeries

Posted: Thu Mar 16, 2006 10:54 am
by 9529132
Hi,

I was trying to realize a real time display of data using FastLineSeries in C++. At first, I studied the demo sample code of "fast delete and fast pen" and came out with my C++ code as
DrawGraph(double dSpeed)
{
double x=m_chart1.Series(0).GetXValues().GetLast()+1;
m_FLseries1.AddRealTime(x,dSpeed,"",clTeeColor);
}
where m_FLseries1 and m_chart1 are class variable and m_FLseries1 is defined as
m_FLseries1 = m_chart1.Series(0).GetAsFastLine();

The code is called every time a new dSpeed came in. When I run the program, an erro dialog pops up without any info and I can't close it unless ctrl-alt-del. Then I altered the code to
DrawGraph(double dSpeed)
{
m_nCounter++;
m_FLseries1.AddRealTime(m_nCounter,dSpeed,"",clTeeColor);
}
where m_nCounter is defined as a class variable. And it works.

Anyone knows why the first way can't work? The sample code in VB is given here:
YValue = .Series(s).YValues.Last + Rnd * 10 - 5
XValue = .Series(s).XValues.Last + 1
.Series(s).asFastLine.AddRealTime XValue, YValue, "", clTeeColor

Thanks in advance.

I am using VC++2003 and Teechart 7.0.0.6

Posted: Tue Mar 21, 2006 1:31 am
by 9529132
How come no reply?

Posted: Thu Mar 30, 2006 7:53 am
by Pep
Hi David,

have you tried to do the following checking ?

if (m_chart.Series(0).GetCount()>0) {
double x=m_chart.Series(0).GetXValues().GetLast()+1;
}

Posted: Thu Mar 30, 2006 8:03 am
by 9529132
Hi, Pep,

Yeah, I noticed it yesterday and I have tried a similiar way. It now works fine. Thanks anyway.

David