How do I know Datasource of a series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
SDG
Newbie
Newbie
Posts: 40
Joined: Tue Apr 08, 2003 4:00 am

How do I know Datasource of a series

Post by SDG » Thu Jan 01, 2004 12:19 pm

How can I get the Datasource of a seies?
I don't want DatasetName.
I think XLabelsSource will get the columnname or FieldName .
but there is no YLabelsSource function.
I want to get X-axis and Y-axis datasource for a series
from the Series Name.
How is this possible?

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

Post by Marjan » Fri Jan 02, 2004 11:16 am

Hi.
How can I get the Datasource of a seies?
By accessing TChartSeries.DataSource property. It can point to other series, table, query, ...
I want to get X-axis and Y-axis datasource for a series from the Series Name.
Not from series name, but rather from XValues.ValueSource and YValues.Valuesource properties. Example

Code: Select all

var XFieldName, YFieldName: String;
XFieldName := Series1.XValues.ValueSource;
YFieldName := Series1.YValues.ValueSource;
Marjan Slatinek,
http://www.steema.com

SDG
Newbie
Newbie
Posts: 40
Joined: Tue Apr 08, 2003 4:00 am

How to get dataset X,y axis firld names.

Post by SDG » Sat Jan 03, 2004 11:31 am

But
Series1.XValues.ValueSource;
and
Series1.YValues.ValueSource;

returns the fieldname only when DAtasource is assigned to Dataset in the design time.

If the Datasource is set to random values in the desing time and datasource is assigned as dataset in the runtime, the above functions are not giving the results.
What is the solution.

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

Post by Marjan » Sat Jan 03, 2004 12:14 pm

If the Datasource is set to random values in the desing time and datasource is assigned as dataset in the runtime, the above functions are not giving the results.
Correct. You also have to connect series XValues and Yvalues ValueSource to appropriate dataset fields. This cannot be done automaticaly. Of course, the same goes for design time - you still have to define fields for YValues, XValues and optionally, XLabels. So, when you connect series to dataset at runtime, you must use the following code:

Code: Select all

Series1.XValues.ValueSource := XFieldName;
Series1.YValues.ValueSource := YFieldName;
Series1.DataSource := Table1;
Series1.CheckDataSource;
Naturally, setting only DataSource property will not change ValueSource property - you have to use the code above to connect series Xvalues, YValues, XLabels to appropriate datasource fields.
Marjan Slatinek,
http://www.steema.com

Post Reply