Proposed BeginUpdate/Endupdate public methods
Posted: Fri Jul 24, 2009 9:16 am
I use BeginUpdate/Endupdate patterns a lot, and have also added these routines to TeeCustomCHart to allow faster filling series with data. I propagated the TCHartSeries.beginUpdate and Endupdate to be called from the TeeCustomChart, rather than having to implement a loop at every spot where I fill my series.
Here's what the routines look like
Potential enhancement: rather add a IUpdating to TeeCustomChart and make routines that check TChartSeries.IUpdating also check TCustomChart.IUpdating.
Code: Select all
MyCHart.Beginupdate
try
// Fill chart series here
finally
MyCHart.Endupdate
end
Code: Select all
// HH This allows for an enourmous optimization. Just call BeginUpdate before adding
// a lot of datapoints, and afterwards call EndUpdate
// All calculated series will be delayed until after adding all datapoints
procedure TCustomChart.BeginUpdate;
VAR i:integer;
begin
for i:=0 to SeriesList.Count-1 do
begin
SeriesList[i].BeginUpdate;
end;
end;
procedure TCustomChart.EndUpdate;
VAR i:integer;
begin
for i:=0 to SeriesList.Count-1 do
begin
SeriesList[i].EndUpdate;
end;
end;