Adding arrays to TLineSeries BCB 6.0

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
MTW
Newbie
Newbie
Posts: 21
Joined: Thu Jun 28, 2007 12:00 am

Adding arrays to TLineSeries BCB 6.0

Post by MTW » Sun Sep 21, 2008 4:53 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Sep 22, 2008 11:08 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

MTW
Newbie
Newbie
Posts: 21
Joined: Thu Jun 28, 2007 12:00 am

Post by MTW » Mon Sep 22, 2008 12:22 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Sep 22, 2008 1:05 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

MTW
Newbie
Newbie
Posts: 21
Joined: Thu Jun 28, 2007 12:00 am

Post by MTW » Mon Sep 22, 2008 1:24 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Sep 22, 2008 2:28 pm

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!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

MTW
Newbie
Newbie
Posts: 21
Joined: Thu Jun 28, 2007 12:00 am

Post by MTW » Mon Sep 22, 2008 2:59 pm

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.

MTW
Newbie
Newbie
Posts: 21
Joined: Thu Jun 28, 2007 12:00 am

Re: Adding arrays to TLineSeries BCB 6.0

Post by MTW » Fri May 28, 2010 6:36 pm

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

Yeray
Site Admin
Site Admin
Posts: 9552
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Adding arrays to TLineSeries BCB 6.0

Post by Yeray » Mon May 31, 2010 9:10 am

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply