problem loading chart from stream

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Nati
Newbie
Newbie
Posts: 37
Joined: Mon Jun 29, 2009 12:00 am

problem loading chart from stream

Post by Nati » Sun Jul 12, 2009 1:09 pm

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
Attachments
err.JPG
err.JPG (17.74 KiB) Viewed 3326 times

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem loading chart from stream

Post by Yeray » Mon Jul 13, 2009 7:42 am

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply