Improve refresh

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
supportinfo
Newbie
Newbie
Posts: 12
Joined: Thu Jan 10, 2019 12:00 am

Improve refresh

Post by supportinfo » Wed Jul 03, 2019 9:39 am

Hello,

I have been using TeeChart for a long time but I am dealing with a slow display problem when I want to display a 2 millions points serie.

By reading documentations, I am using a TFastLineSeries serie with some particular options in order to speed up display:

Code: Select all

      DrawAllPoints:= False ;
      DrawAllPointsStyle:= daMinMax ;
      FastPen:= False ;
      AutoRepaint:= False ;
I also tried to set Min/Max before adding data to serie but it didn't improve display.

The display is very slow while the filling of the serie is fast.

Here is the link of my project with datas to display:
https://drive.google.com/open?id=1z_0AU ... 4yodkAj12U

Does someone has an idea or some tips to improve display ?

Regards

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

Re: Improve refresh

Post by Yeray » Wed Jul 10, 2019 1:57 pm

Hello,

I've added a couple of extra columns to check the drawing speed and the number of values in the series:

Code: Select all

var tmpDraw: Int64 ;

procedure TForm1.va(Sender: TObject);
begin
  tmpDraw:= GetTickCount64 ;
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
  StringGrid1.Cells[2, StringGrid1.RowCount-2]:= IntToStr(GetTickCount64 - tmpDraw) ;
end;

procedure TForm1.ListBox1HddDblClick(Sender: TObject);
//...
  StringGrid1.Cells[2,0]:= 'Chart draw' ;
  StringGrid1.Cells[3,0]:= 'Points' ;
  //...
    StringGrid1.Cells[3, StringGrid1.RowCount-1]:= IntToStr(k) ;
  //...
Here the results I get:
- Drawing all the points (DrawAllPoints=True):
Project1_2019-07-10_15-40-47.png
Project1_2019-07-10_15-40-47.png (73.07 KiB) Viewed 9757 times
- Using daMinMax algorithm:
Project1_2019-07-10_15-35-09.png
Project1_2019-07-10_15-35-09.png (73.45 KiB) Viewed 9757 times
- Using daFirst:
Project1_2019-07-10_15-36-34.png
Project1_2019-07-10_15-36-34.png (72.01 KiB) Viewed 9757 times
We can see that, for the given data and configuration, the daMinMax algorithm doesn't improve the drawing speed, but the daFirst algorithm has a significant impact on the drawing speed.

Another alternative is to use the TSmoothingFunction, which takes some time to calculate, but improves the drawing speed with a result more similar to the original series:

Code: Select all

    DownSampleSerie := TFastLineSeries.Create(Nil) ;
    with DownSampleSerie do
    begin
      ParentChart:= Chart1 ;
      Color:=IntensiteSerie.Color;

      DownSampleFun := TDownSamplingFunction.Create(nil);
      SetFunction(DownSampleFun);

      DownSampleFun.Tolerance := 4;
      DownSampleFun.DownSampleMethod := dsAverage;

      DataSource := IntensiteSerie;
    end;
Project1_2019-07-10_15-55-25.png
Project1_2019-07-10_15-55-25.png (63.54 KiB) Viewed 9757 times
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