Page 1 of 1
Adding arrays to TLineSeries BCB 6.0
Posted: Sun Sep 21, 2008 4:53 am
by 10045810
I am trying to add an array of X and an array of Y values to a TLineSeries (TFastLineSeries) using BCB 6.0. I cannot see how to do this from the examples. Any assistance would greatly be appreciated.
Thanks
M Weingarden
Posted: Mon Sep 22, 2008 11:08 am
by narcis
Hi MTW,
You can find an example at All Features\Welcome!\Speed\Fast Dynamic Arrays at the new features demo, available at TeeChart's program group.
Posted: Mon Sep 22, 2008 12:22 pm
by 10045810
Thank you.
However, when I run Tee8New.exe, I get an error "Class TSurfaceSides Not Found" and when I go to All Features\Welcome\Speed\Fast Dynamic Arrays, I do not get the example showing.
Perhaps you could identify the module that uses arrays for both X and Y variables. I am able to use AddArray for Y variables, but I do not see how to do it for the X data elements as well.
Posted: Mon Sep 22, 2008 1:05 pm
by narcis
Hi MTW,
AddArray only supports adding Y values array. For adding X and Y values you need to do as in the menitoned example, which is very similar to the
Real-time Charting article
here.
Which TeeChart version are you using? I'll send you the URL to download v8.03 which is a test version. We will soon release v8.04.
Posted: Mon Sep 22, 2008 1:24 pm
by 10045810
I am using V 8.0.
I have seen the article and am trying to figure out how to get it done in C - BCB v6.0.
If there is a BCB example, as demonstrated in the article, in one of the modules in the example folders, I will gladly look at it. If not, is it possible to include a few lines of code showing how to add the X and Y arrays in C.
Thank you
Posted: Mon Sep 22, 2008 2:28 pm
by narcis
Hello,
This is how can you add X and Y values arrays to series using BCB 6:
Code: Select all
// TChartValues
DynamicArray<double> X;
DynamicArray<double> Y;
// number of points }
int Num = StrToInt(Edit1->Text);
// allocate our custom arrays }
X.Length = Num;
Y.Length = Num;
// fill data in our custom arrays }
X[0] = 0;
Y[0] = random(10000);
for (int t=1; t<Num;t++)
{
X[t] = t;
Y[t] = Y[t-1]+random(101)-50;
}
// set our X array }
Series1->XValues->Value =(TChartValues)(X); // <-- the array
Series1->XValues->Count = Num; // <-- number of points
Series1->XValues->Modified = true; // <-- recalculate min and max
// set our Y array }
Series1->YValues->Value = (TChartValues)(Y); // <-- the array
Series1->YValues->Count = Num; // <-- number of points
Series1->YValues->Modified = true; // <-- recalculate min and max
Chart1->UndoZoom(); // <-- remove zoom (optional)
// Show data
Series1->Repaint();
Hope this helps!
Posted: Mon Sep 22, 2008 2:59 pm
by 10045810
Thank you very much. I was close in some of my attempts, based upon the article and porting it to C, but your example resolves all the issues I ran into.
Re: Adding arrays to TLineSeries BCB 6.0
Posted: Fri May 28, 2010 6:36 pm
by 10045810
I am now using TeeChart VCL 8.06 in both BCB 6.0 and CodeGear 2010.
Your description of using an array for adding both X and Y values allows me to code it and use the functions as described. However, I am now using it for real time graphics, where I want to add a set of data to a chart (that has existing data). I would like to retain the existing data, unless I am over my display number of points, when then I use the Delete function. What I am seeing is that when I add the X,Y values as shown, it is replacing the existing data set with the new set and all previous data is lost.
Is there a way to add the X Y array (C++ code) to existing data in the graph? In the realtime article, it shows that data can be added to Value.Last. Is there any way to do this with an array?
Thank you
M Weingarden
Re: Adding arrays to TLineSeries BCB 6.0
Posted: Mon May 31, 2010 9:10 am
by yeray
Hi
The AddArray function is a feature request already in the with list (TV52014513), as you can see
here.
I've incremented it's priority.