Page 1 of 1

How can I remove points from TChartSeries

Posted: Thu May 20, 2010 12:21 pm
by 9233301
Hi,

I have added so many points to a series by calling AddXY that EOutOfMemory is raised whenever I'm calling AddXY again. Now, I want to remove every second point of the chart (i.e. reduce the number of samples) to free some memory. How can I do that?

Regards,

S.

Re: How can I remove points from TChartSeries

Posted: Thu May 20, 2010 1:39 pm
by yeray
Hi susi,

Is the following what you are trying to do?

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var i: Integer;
begin
  i:=1;
  while (i < Series1.Count-1) do
  begin
    Series1.Delete(i);
    i:=i+1;
  end;
end;

Re: How can I remove points from TChartSeries

Posted: Fri May 21, 2010 11:39 am
by 9233301
Yes, but the software hangs when I do that with a chart that is so big that it raised the EOutOfMemory exception.

Re: How can I remove points from TChartSeries

Posted: Fri May 21, 2010 1:44 pm
by yeray
Hi susi,

If the problem is with the drawing of the big amount of points, you could try with the DownSampling function (see the demo at All features\Welcome !\Functions\Extended\Reducing number of points)
If the problem is with the memory, as it seems to be, there isn't too much TeeChart can do for you. It depends on the machine capacity and the number of values you are loading into memory. Here the better option would be to add some control of the points before being added.

If you still have problems with it, please send us a simple example project we can run as-is to reproduce the problem here.