Page 1 of 1

problem loading chart from stream

Posted: Sun Jul 12, 2009 1:09 pm
by 10553605
hi

when saving a chart to stream im using the following code:
SaveChartToStream(Chart1,strm,TRUE,TRUE);
strm : TMemoryStream;

when loading it back im using the following code:
LoadChartFromStream(TCustomChart(Chart1),strm);
i have to typecast to TCustomChart or else it wont compile
when the code is executed i get the attached error.
the error is internal and is visible only when running in debug mode, running it from outside of delphi nothing is shown to the user.
anyway, the loading is successful as if nothing happened

please advice

Re: problem loading chart from stream

Posted: Mon Jul 13, 2009 7:42 am
by yeray
Hi Nati,

The following example seems to work fine here:

Code: Select all

uses teestore, series;

procedure TForm1.Button1Click(Sender: TObject);
begin
  SaveChartToStream(Chart1,strm,TRUE,TRUE);
  Chart1.RemoveAllSeries;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  strm.Position := 0;
  LoadChartFromStream(TCustomChart(Chart1),strm);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  strm := TMemoryStream.Create;

  Chart1.AddSeries(TPointSeries.Create(self));
  Chart1[0].FillSampleValues(25);
end;
Could you please modify it or attach here a simple example project we can run as-is to reproduce the problem here?

Thanks in advance.