Streaming Chart Request

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Ed
Newbie
Newbie
Posts: 33
Joined: Tue Mar 09, 2004 5:00 am
Location: Oregon, USA
Contact:

Streaming Chart Request

Post by Ed » Thu May 27, 2004 6:27 pm

When streaming a chart:

SaveChartToStream(aChart, lMS, True);

If the chart parents any controls, those controlls are streamed as well. Is there any way to prevent this? (If the controls aren't registered it causes an exception).

Ed Dressel

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon May 31, 2004 11:37 am

Hi, Ed.

Perhaps one solution is to create a temporary chart with no parent win control, copy/assign all properties from original to this chart, clone all series from original to temporary chart and finally export temporary chart to a stream. Something along these lines:

Code: Select all

Uses TeeStore, TeeEditPRO;

procedure TForm1.btnSaveClick(Sender: TObject);
var tmpChart : TChart;
    i: Integer;
begin
  tmpChart := TChart.Create(Self);
  try
    tmpChart.Assign(Chart1);
    for i := 0 to Chart1.SeriesCount - 1 do
      CloneChartSeries(Chart1.Series[i]).ParentChart := tmpChart;

    SaveChartToFile(tmpChart,'d:\temp\result.tee',true);
  finally
    tmpChart.Free;
  end;


end;

procedure TForm1.btnLoadClick(Sender: TObject);
begin
    LoadChartFromFile(TCustomChart(Chart2),'d:\temp\result.tee');
end;
Marjan Slatinek,
http://www.steema.com

Post Reply