Question

My previous question had some great input, but it didn't work for me because my problem seems to be Delphi 7 related.

I have a chart with a single series (TFastLineSeries) and 3,600 datapoints which is taking up to 45 seconds to draw. Others have said that it should be lightning fast, so who can help, bearing in mind that I am using Delphi 7 and the standard TChart component.

I suspect that instead of calling AddXY() 3,600 times I should be preparing the data first, then adding it all at once.


Update: in D7 the AddXy() function signature is function AddXY(Const AXValue, AYValue: Double; Const AXLabel: String; AColor: TColor) : Longint; wheretimeLabelis 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 have coded Chart1.Series[0].XValues.DateTime := True; Chart1.BottomAxis.DateTimeFormat := 'nn:ss'; //'hh' or 'nn' or 'ss' as you wish, e.g. Chart1.BottomAxis.DateTimeFormat:="dd/mm/yyyy hh:mm";

Was it helpful?

Solution

Maybe the way you are generating the values to put in the chart is the bottleneck?

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

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

OTHER TIPS

Btw: It can also speed up the drawing to set Chart1.AutoRepaint to false before you add your values and set if back to true afterwards

This may help you from the developer of TeeChart.... Fast line drawing with TeeChart

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top