Tchart Nitrogen simulation lazarus / 55-TAChart ---------------------------------------------------------------------- flori · 2021-03-19 19:19 Hi everyone! Is it possible to simulate  (start/and) data from a database on Tchart? I attached demo project.  I have a lot of measurements  it should be presented in real time. Thank u. ---------------------------------------------------------------------- wp · 2021-03-19 20:50 There are several examples of real-time charts here in this forum. Please use the forum search. ---------------------------------------------------------------------- wp · 2021-03-19 20:59 Tried to run your demo, but again I cannot get it work. Please rewrite your demo such that a simple database is used. I don't see why I should install Firebird and the ZEOS components just the help you with a TAChart question. ---------------------------------------------------------------------- flori · 2021-03-19 21:58 ok. I converted some data to dbf. ---------------------------------------------------------------------- wp · 2021-03-19 23:07 What exactly is the problem? At least, I can fix the crash of your demo program. I am not very happy about TDbChartSource being in TAChart. It is a very "stupic" datasource, relies heavily on the RecNo and RecordCount properties of the dataset which are known to be very unreliable, in particular with server databases (but even with the TDbf in your example RecordCount returns a wrong value). It is highly recommended to copy the dataset records into a TListChartSource, either a separate component or the built-in ListSource of the series: 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 var  NitrogenField: TField;  i: Integer;begin  // Copy the dataset to a ListChartSource. Do not use DBChartSource.  NitrogenField := Dbf1.FieldByName('Nitrogen');  Dbf1.First;  i := 1;  while not Dbf1.EoF do  begin    ListChartSource1.Add(i, NitrogenField.AsFloat);    Dbf1.Next;    inc(i);  end; end; Since your sample code does not provide a field for the x values, I used a counter variable (i) for x. After these changes in the FormCreate event (and assigning the ListChartSource1 to the Source property of the series, instead of the DBChartSoruce), your demo no longer crashes. ---------------------------------------------------------------------- flori · 2021-03-20 08:34 WP thank you. So when I use ZEOS component and Tchart with dbchartsource I need to copy the dataset into TlistChartSource....Because the dbchartsource records is  unreliable. After copy data into TlistChartSource is it possible to simulate on Tchart with Timer?  The list TlistChartSource  data can be assigned to a Timer? ---------------------------------------------------------------------- wp · 2021-03-20 09:49 I don't know what you mean exactly. When you want to say that you want to read the database periodically to display the data in a chart: of course this is possible. Add a timer with an appropriate (not too small) interval and in the OnTimer event refresh the dataset and copy the records to the listchartsource (do a ListChartSource.Clear at first in order to clear the series from the old data).