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
Streaming Chart Request
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:
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
http://www.steema.com