I need to draw several geometric shapes on the same graph lazarus / 55-TAChart ---------------------------------------------------------------------- Emmanuel · 2014-02-11 14:39 I m trying  with the TAchart component and using LineSerie option  to draw several squares objects on the same graph (according to 4  coordinates points), but each time the squares are linked by a line from the previous square(due to the fact that lines are drawn from the previous point what ever the object). Do you know if there is a way to consider each geometric shape as individual object ? Do I have to put each shape in a different series, in order to be sure that no extra line will be add ? In this cas I don't know how to create a new serie in run time, do you know if there is series number limitation? . Can you help me ???? ... I hope that my problem is clear enough  Thank you for your help !!! Emmanuel ---------------------------------------------------------------------- wp · 2014-02-11 15:26 Two options: Use a single series, separate the geometric objects by adding a data point with NaN in between:Code: [Select]  with Chart1Lineseries1 do begin     // shape #1: square     AddXY(0, 0);   // point #1     AddXY(0, 1);   // point #2     AddXY(1, 1);   // point #3     AddXY(1, 0);   // point #4     AddXY(0, 0);   // last point to close polygon     // separator     AddXY(0, NaN);     // shape #2: square     AddXY(2, 0);     AddXY(2, 1);     AddXY(3, 1);     AddXY(3, 0);     AddXY(2, 0);   end; end; Or use separate series. Here's an example to create two lineseries at runtime and to populate them with points (there is no built-in limitation of series count):Code: [Select]procedure TForm1.CreateShapes; var   series1, series2: TLineSeries; begin   series1 := TLineSeries.Create(self);   with series1 do begin     SeriesColor := clRed;     AddXY(0, 0);   // point #1     AddXY(0, 1);   // point #2     AddXY(1, 1);   // point #3     AddXY(1, 0);   // point #4     AddXY(0, 0);   // last point to close polygon   end;   Chart1.AddSeries(series1);   series2 := TLineSeries.Create(self);   with series2 do begin     SeriesColor := clBlue;     AddXY(2, 0);     AddXY(2, 1);     AddXY(3, 1);     AddXY(3, 0);     AddXY(2,0);   end;   Chart1.AddSeries(series2); end; ---------------------------------------------------------------------- Emmanuel · 2014-02-12 10:03 Thank you for the answer. the first solution seems simple  Nevertheless I still have a problem when I use the NaN value, when I compile the code, I recieve the error message that NAN value is not defined, and I wonder how to define it ??? as Integer ??? in this case NAN take the value 0. Clearly I m missing something  Thank you again for your help ---------------------------------------------------------------------- Jkey · 2014-02-12 12:13 Hello, NaN is a constant in unit called Math, so you don't need to define it, simply insert Math unit into the uses section. ---------------------------------------------------------------------- wp · 2014-02-12 15:07 NaN is a special floating point value which means "not a number". In practice, it can be used to indicate values that have no numerical meaning. But be warned, every attempt to use NaN in a calculation will produce an exception, even something like "if x = NaN" is fatal (use "if IsNaN(x)" instead).