Page 1 of 1

SaveChartToFile doesn't save groups

Posted: Sat May 15, 2004 5:01 am
by 9337383
I noticed that saving a chart to a file does not save any groups the user creates at runtime. Is there something else you have to do to save groups along with the chart?
Thanks. 8)

Posted: Mon May 17, 2004 1:23 pm
by Marjan
Hi.

Using TeeChart and code bellow bar series stack group are saved and correctly loaded:

Code: Select all

Uses TeeStore,
    TeeEditPRO;   //  <--- Registerrs all series classes

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.FreeAllSeries(nil);
  Chart1.AddSeries(TBarSeries);
  Chart1.AddSeries(TBarSeries);
  Chart1.AddSeries(TBarSeries);

  Chart1.Series[0].FillSampleValues(5);
  Chart1.Series[1].FillSampleValues(5);
  Chart1.Series[2].FillSampleValues(5);

  With (Chart1.Series[0] as TBarSeries) do
  begin
    MultiBar := mbStacked;
    StackGroup := 0;
  end;
  With (Chart1.Series[1] as TBarSeries) do
  begin
    MultiBar := mbStacked;
    StackGroup := 0;
  end;


  With (Chart1.Series[2] as TBarSeries) do
  begin
    MultiBar := mbStacked;
    StackGroup := 1;
  end;

end;

procedure TForm1.btnSaveClick(Sender: TObject);
begin
  SaveChartToFile(Chart1,'d:\temp\result.tee',True); // <--- Include data
  Chart1.FreeAllSeries(nil);
end;

procedure TForm1.btnLoadClick(Sender: TObject);
begin
  LoadChartFromFile(TCustomChart(Chart1),'d:\temp\result.tee');
end;