Page 1 of 1

Proposed BeginUpdate/Endupdate public methods

Posted: Fri Jul 24, 2009 9:16 am
by 10553957
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.

Code: Select all

MyCHart.Beginupdate
try
  // Fill chart series here
finally
  MyCHart.Endupdate
end
Here's what the routines look like

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;
Potential enhancement: rather add a IUpdating to TeeCustomChart and make routines that check TChartSeries.IUpdating also check TCustomChart.IUpdating.

Re: Proposed BeginUpdate/Endupdate public methods

Posted: Fri Jul 24, 2009 1:44 pm
by yeray
Hi Hans,

I've added this to the wish list to be considered for inclusion in future releases (TV52014309). Thanks for the proposal.
Have you also viewed the Real-time Charting article?