Big TChart takes a long time to draw

Top post: I accepted the answer, but it does not work for me. I will post a new question highlighting Delphi 7. Thanks to everyone who gave a good input


I have measurements taken at intervals of one second for an hour.

I had a previous question about where there were 45 seconds to update the TStringGrid and managed to achieve this to "faster than the eye can see." In part, moving some of the computational and database-related functionality of the loop, but, surprisingly for me, the change that really mattered was to set strindgrid rowCount to 3600 before the loop, and not increase it inside the loop.

Now I have a similar problem with TChart. Maybe if I try to redistribute the schedule? That way I could Chart1.Series[0].Count := 3600, but how can I not use AddXy()or Add(), since I would explicitly set the values ​​sequentially?

I have a very simple chart with floats on the y axis and hour: seconds on the x axis

Can someone help or suggest another way to speed up charting?


Update: several were offered to use TFastLineSeries, but I do not see how.

Aha - double-click on the chart to show all series, select one and click on change

+3
source share
3 answers

. : , X Y, , . :

var
  XValues, YValues: array of double; 
begin

  SetLength(XValues, numberofValues);
  SetLength(YValues, numberofValues);

  for ix := 0 to numberofValues - 1 do 
  begin
    XValues[ix] := ...your values
    YValues[ix] := ...your values
  end;

  Chart.Series[0].XValues.Value := TChartValues(XValues);
  Chart.Series[0].XValues.Count := high(XValues);
  Chart.Series[0].XValues.Modified := true;
  Chart.Series[0].YValues.Value := TChartValues(YValues);
  Chart.Series[0].YValues.Count := high(YValues);
  Chart.Series[0].YValues.Modified := True;

, TFastLineSeries TLineSeries. FastlineSeries DrawAllPoints. false, . TChart , X . .

DrawAllPoints: alt text

+4
+5

I just would like to comment on the answer of Michael Schmucks. Using High (XValues) to set the Count value for a series results in the last element in the array not being displayed. This is because high (XValues) returns the highest index of the array, not the size of the array.

Of course, this is only noticed when adding a very low number of elements.

Chart.Series[0].XValues.Count := high(XValues) + 1;
+2
source

Source: https://habr.com/ru/post/1787123/


All Articles