Page 1 of 1
Streaming Chart Request
Posted: Thu May 27, 2004 6:27 pm
by 9336214
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
Posted: Mon May 31, 2004 11:37 am
by Marjan
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;