Page 1 of 1

LoadChartFromFile/SaveChartToFile help needed!

Posted: Tue Aug 30, 2016 12:03 pm
by 16479009
Hi,

I am desperately seeking a way to both save and load chart settings without data as well as with. I understand that SaveChartToFile can be paramaterised so that only the chart settings are exported - and not the data - which is ideal. However, when loading the settings back in I find that the chart no longer works with my code, flagging invliad references to the TLineSeries object that was there previously. If I reference the TChartSeries - e.g. Chart1.Series[0] - then it works but my code is deisgned to interact with the TLineSeries object (Series1) and I would ideally not like to change this. Is there something I an do to get round this issue?

Re: LoadChartFromFile/SaveChartToFile help needed!

Posted: Wed Aug 31, 2016 7:37 am
by yeray
Hello,

The variables aren't stored in the object so the chart can't recreate them when loading the tee file.
However, you can reassign them if you want. Ie with a TPieSeries:

Code: Select all

uses Chart, Series, TeeConst, TeeStore;

procedure TForm1.FormCreate(Sender: TObject);
var Chart1: TChart;
    Series1: TPieSeries;
begin
  Chart1:=TChart.Create(Self);
  LoadChartFromFile(Chart1, 'C:\tmp\pie.tee');
  Chart1.Parent:=Self;

  Series1:=Chart1[0] as TPieSeries;
  Series1.Circled:=false;
end;

initialization

RegisterTeeSeries(TPieSeries, @TeeMsg_GalleryPie, @TeeMsg_GalleryStandard, 1);