How to Share Series Between Charts

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Mark
Newbie
Newbie
Posts: 1
Joined: Mon May 31, 2004 4:00 am
Location: Houston, TX

How to Share Series Between Charts

Post by Mark » Tue Jun 08, 2004 9:18 pm

I would like to share series data between multiple charts (for instance in a multi-monitor application) but don't want to simply copy the data to redundant series. I want to share the data so that each series is in memory only once. How should I do this?

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Wed Jun 09, 2004 6:48 pm

Hi.

Hmm.... Once series is created you can control where it would be displayed by changing it's ParentChart property. The problem is ParentChart is is only single chart i.e. at the same time specific series can be displayed only on one chart.
One way around this limitation is to "copy" the values from one series to another one. Something like this:

Code: Select all

  sourceSeries.FillSampleValues(100);
  targetSeries.AssignValues(sourceSeries);
The problem with this method is the place allocated for the same data will be twice as big as for single series.

Another solution (if you don't need to show both series at the same time) is to change series ParentChart property from one chart to antoher one:

Code: Select all

series1.ParentChart := tChart1;
//switch
series1.ParentChart := tChart2;
Marjan Slatinek,
http://www.steema.com

Pep
Site Admin
Site Admin
Posts: 3298
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Jun 09, 2004 10:55 pm

Hi,

there's also another solution which is to using two Series (one for each Chart) and set the DataSource of the Series2 to Series1, so when the data of Series1 will be modified will also be applied to the Series2.
Series2.DataSource := Series1;

Post Reply