How to clear all datasources in a chart
Posted: Sat Jul 28, 2018 1:19 am
Good afternoon
I have a reasonably complex chart, with series from a number of data sources. When I make any change to the chart, I prefer to clear all data sources and rebuild the chart using standard code. I have tried the following code:
However, this does not appear to work, as IDataSources.Count in VCLTee.DBChart.RefreshData keeps increasing every time I modify my chart.
To overcome this problem, I wrote a public procedure in VCLTee.DBChart as follows:
This works fine, and the number of datasources reported in DBChart.RefreshData correctly matches the actual number used by the chart.
Of course, a procedure in VCLTee.DBChart is not satisfactory, as I lose this on every TeeChart code upgrade. How can I permanently access this simple functionality?
Thanks and regards
Errol
I have a reasonably complex chart, with series from a number of data sources. When I make any change to the chart, I prefer to clear all data sources and rebuild the chart using standard code. I have tried the following code:
Code: Select all
if Chart.SeriesCount <> 0 then
begin
for i := 0 to Chart.SeriesCount - 1 do
Chart.Series[i].DataSources.Clear;
end;
However, this does not appear to work, as IDataSources.Count in VCLTee.DBChart.RefreshData keeps increasing every time I modify my chart.
To overcome this problem, I wrote a public procedure in VCLTee.DBChart as follows:
Code: Select all
procedure TCustomDBChart.ClearDataSources;
begin
iDataSources.Clear;
end;
Of course, a procedure in VCLTee.DBChart is not satisfactory, as I lose this on every TeeChart code upgrade. How can I permanently access this simple functionality?
Thanks and regards
Errol