[SOLVED] Charts: how to add a new point and erase the oldest one? lazarus / 61-Beginners ---------------------------------------------------------------------- valford · 2018-01-25 05:46 Hello, (I'm going to say sorry about my English in advance xD). I am creating a chart with data which came every one second (one point per second). I can create the chart but after an hour is full of point and is difficult to see the detail of the last point o the last few points. I do not want to do a zoom manually, I want to have a maximum number of points in my chart (we will say 60 points) and after that delete one point from the beginning and add the new one in the line ("moving" the X axis, I do not want to restart the point number). So when the point number 61 will add I should erase the point number 1; add 62, erase 2; 63-3... and so on. I have been trying to do it using the object inspector and the AxisTransformation, but now I am running off of ideas  Does someone know how to do it? ---------------------------------------------------------------------- wp · 2018-01-25 08:39 I assume that you add datapoints to the series by calling one its Add* methods, i.e. Series.AddXY(x, y). Then the data are stored in a TChartListSource which is accessible as Series.ListSource. Every ChartListSource has a property Count telling you the number of data points stored, and a method Delete(AIndex) which delete the datapoint with the specified index. Therefore, you just delete the 0-th data point if the Count is larger than the allowed value: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if Series.ListSource.Count > MAX_POINTS_VISIBLE then  Series.ListSource.Delete(0); Since in case of a LineSeries (or other descendants of TBasicPointSeries) some properties of the ListSource are passed to properties of the series you can also write Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if Series.Count > MAX_POINTS_VISIBLE then  Series.Delete(0); The attached demo works this way. In addition it also sets the LogicalExtent of the chart in order to obtain a smoother display. Note that the code assumes that the x values are equal to the point index; otherwise modifications are required, but I hope you get the idea ---------------------------------------------------------------------- valford · 2018-01-29 05:13 Thanks, it works perfectly!