Loading colors with SeriesTextSource

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
pssdelphi
Newbie
Newbie
Posts: 29
Joined: Thu Oct 21, 2004 4:00 am

Loading colors with SeriesTextSource

Post by pssdelphi » Tue Feb 06, 2007 11:29 pm

When I save a line series with:

Code: Select all

  with TSeriesDataText.Create(Chart1, sLines) do
  try
    TextDelimiter:=',';
    IncludeIndex:=false;
    IncludeHeader:=true;
    IncludeLabels:=true;
    IncludeColors:=true;
    SaveToFile('chart1.txt');
  finally
    Free;
  end;
The fields in the result file are in the order:
Text,Colors,X,Y,EndX,EndY

And then try to load it back with:

Code: Select all

    with SeriesTextSource1 do
    begin
      Fields.Clear;
      AddField('Text',1);
      AddField('Colors',2);
      AddField('X',3);
      AddField('Y',4);
      AddField('EndX',5);
      AddField('EndY',6);
      FieldSeparator := ',';
      DecimalSeparator := '.';
      FileName := 'chart1.txt';
      Series := sLines;
      Active := True;
    end;
I get an error that my color is not a value floating point value.
When I check the datasource for the series it lists the fields:
Text
X
Y
EndX
EndY

but no Colors as an option for source.
What am I missing to get the colors to import?

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

Post by Pep » Mon Feb 12, 2007 12:25 pm

Hi,

the colors cannot be imported directly, it has to be done manually (if desired), in your case to import datavalues into your series without colors will have to comment the line where you try to load the colors.

You can to know all the fields that can be load for each Series type using :

For colcount := 0 To Series1.ValuesList.Count - 1 do
showmessage(Series1.ValuesList[colcount].Name);

I've added this feature on our wish list to be considered for further releases.

pssdelphi
Newbie
Newbie
Posts: 29
Joined: Thu Oct 21, 2004 4:00 am

Post by pssdelphi » Mon Feb 12, 2007 2:13 pm

Thanks for the reply.
Since I wrote this question I have written my own import and export routines because other needs arose to store even more information that seemed beyond the scope of what SeriesTextSource was designed for. I do agree that Colors should be added to the SeriesTextSource routine, since this is one of the basic elements of each series.

Post Reply