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 (73.07 KiB) Viewed 9691 times
- Using daMinMax algorithm:
- Project1_2019-07-10_15-35-09.png (73.45 KiB) Viewed 9691 times
- Using daFirst:
- Project1_2019-07-10_15-36-34.png (72.01 KiB) Viewed 9691 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 (63.54 KiB) Viewed 9691 times