Top post: I have accepted an answer,but it doesn\'t work for me. I will post a new question, stressing Delphi 7. Thanks to all who gave some good input
I have me
I would just like to comment on the Michael Schmooks answer. Using High(XValues) to set the Count value for the series causes the last item in the array not to be displayed. This is because high(XValues) returns the highest index of the array, and not the size of the array.
Of course, this is only noticed when a very low nr of items happens to be added.
Chart.Series[0].XValues.Count := high(XValues) + 1;
I manage to draw millons of datapoints in a blink of an eye. Here's how I do it: What you can do is to create two arrays for the X and Y Values, fill them with your values and then these arrays to your chart. For example:
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;
What also speeds up the drawing is using the TFastLineSeries instead of the regular TLineSeries. When using the FastlineSeries you also have the property DrawAllPoints. When set to false the drawing is even faster. TChart will then skip datapoints that share the same X Position with other datapoints on the screen. It will only draw the first point of these.
This is where you find it the DrawAllPoints option:
You can find the "official" recommendations about fast charting on Steema website