Proposed BeginUpdate/Endupdate public methods

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
h.hasenack
Newbie
Newbie
Posts: 32
Joined: Tue Jul 21, 2009 12:00 am
Location: Nijmegen, Netherlands

Proposed BeginUpdate/Endupdate public methods

Post by h.hasenack » 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.

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.

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Proposed BeginUpdate/Endupdate public methods

Post by Yeray » Fri Jul 24, 2009 1:44 pm

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?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply