Page 1 of 1

Loading colors with SeriesTextSource

Posted: Tue Feb 06, 2007 11:29 pm
by 9339638
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?

Posted: Mon Feb 12, 2007 12:25 pm
by Pep
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.

Posted: Mon Feb 12, 2007 2:13 pm
by 9339638
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.