[SOLVED] How to avoid null data? lazarus / 55-TAChart ---------------------------------------------------------------------- madepabloh · 2014-08-18 19:00 I am writting a simple application what read a csv file, shows the data into an stringgrid, and plot the values in a chart. Since the numbers of columns is unknown, i add the series in runtime by counting the humber of columns in the stringgrid. Everything works fine except when the cells are empty. I know there is an example in TAChart component about to assign "NaN" to that component, and after explore the example and this forum, i still can´t figure out how could i use this information to my case. This is the procedure i create to read the stringgrid and create lineseries in the Chart: Code: [Select]procedure TMain.PlotData (Table: TstringGrid; Chart: TChart);  var   colnumber: Integer;   rownumber: integer;   ls: Tlineseries;   x: TDateTime;   y: double; begin   Chart.ClearSeries;   colnumber := Table.ColCount;   rownumber := Table.RowCount;   for i := 0 to colnumber-2 do     begin       ls := Tlineseries.Create(Chart);       chart.addSeries(ls);       ls.Legend.Format := Table.Cells[i+2, 1];       for n := 2 to Rownumber-1 do         begin           x := StrToDateTime(Table.Cells[1, n]);           y := StrToFloat(Table.Cells[i + 2, n]);           ls.AddXY(x, y);         end;     end; end; How could i solve this issue? Thanks! ---------------------------------------------------------------------- taazz · 2014-08-18 19:29 Code: [Select]procedure TMain.PlotData (Table: TstringGrid; Chart: TChart);  var   colnumber: Integer;   rownumber: integer;   ls: Tlineseries;   x: TDateTime;   y: double; begin   Chart.ClearSeries;   colnumber := Table.ColCount;   rownumber := Table.RowCount;   for i := 0 to colnumber-2 do     begin       ls := Tlineseries.Create(Chart);       chart.addSeries(ls);       ls.Legend.Format := Table.Cells[i+2, 1];       for n := 2 to Rownumber-1 do         begin           if TryStrToFloat(Table.Cells[i + 2, n], y) then begin             x := StrToDateTime(Table.Cells[1, n]);             ls.AddXY(x, y);           end;         end;     end; end; ---------------------------------------------------------------------- madepabloh · 2014-08-18 21:15 OMG! It was so simple! I had on mind really complex procedures... Thanks so much @taazz for to modify my code. It work nice now! Thanks!!