TCHart drawing optimization in Delphi 7

My previous question had some kind of big contribution, but it didn’t work for me, because my problem is related to Delphi 7.

I have a chart with one series (TFastLineSeries) and 3600 data points, which takes up to 45 seconds to draw. Others said that this should be lightning fast, so who can help, bearing in mind that I use Delphi 7 and the standard TChart component.

I suspect that instead of calling AddXY () 3,600 times, I must first prepare the data and then add them all at once.


Update: in D7, the signature of the AddXy () function AddXY(Const AXValue, AYValue: Double; Const AXLabel: String; AColor: TColor) : Longint; wheretimeLabel functionis a string representing MM:SS. But what value should I be passing for

and I cam calling it with Chart1.Series [0] .AddXY (Chart1.Series [0] .Count, codValue, timeLabel, clRed


btw, I encoded Chart1.Series [0] .XValues.DateTime: = True; Chart1.BottomAxis.DateTimeFormat: = 'nn: ss'; // 'hh' or 'nn' or 'ss' as you wish, for example. Chart1.BottomAxis.DateTimeFormat: = "dd / mm / yyyy hh: mm";

+1
source share
3 answers

Maybe the way you generate the values ​​you enter in the chart is a bottleneck?

In Delphi 2010, I measured the following code to take less than 1/10 of a second:

var
  I: Integer;
begin
  for I := 0 to 3000 - 1 do
    Series1.AddXY(Random(1000), Random(100));
+1
source

Btw: it can also speed up drawing to set Chart1.AutoRepaint to false before you add your values ​​and set whether it will be back to true

+1
source

This can help you from the TeeChart developer .... Quick line drawing with TeeChart

+1
source

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


All Articles