tachart: stationary data, rolling insert line for reduced screen flicker lazarus / 55-TAChart ---------------------------------------------------------------------- mas steindorff · 2019-04-28 20:26 Hello, 1st off, great work on tachart.  I tried it 10+ years ago and for something simuler and found it too buggy to use for shipping code.  I ran the same test last week and it ran solid so I'm trying it out for a new project I'm working on. I would like to plot 3 to 6 live data streams, each to it's own plot for auto scale options later.  I've created code following the line line demo- oscilloscope but I have a lot of screen flicker and a "pulsing"  of the right axis width.  you can see this in the demo code as well just by reducing the timer interval down to under 80 ms or so. (yes, the double buffer option is enabled).  my data streams are 1,000 samples /second on each channel but I buffer 100 readings before updating each chart. What I'm really after (to aid the end user) is a way to keep the data stationary and move the insert point along the x-axis.  A moving vertical line would separate the new and old data and the x axis (labels) would update a the insert point as well.  this looks like a heart monitor. Is this one of tachart's mode's and if so, where can I find an example. if not, is there any way to fix the issues seen in the oscilloscope demo when it is ran 3 times faster? PS:later I'll want to do a FFT on the data and display it in a "water fall" format.  this is where a line of new points is inserted at the base line shifting up the older data.  is this a TAchart option yet? Thank you for reading ---------------------------------------------------------------------- wp · 2019-04-28 22:25 In the oscilloscope demo I don't see any flicker down to less than 10 ms after I increased the left and right MarginExternal values, and for the right I added a second y axis to the right so that I could freeze its distance to the edge (property "LabelSize") to avoid the "pulsing" effect; the axis itself was made invisible then again by setting its Marks.Visible to false. Try attached modified oscilloscope demo. The other demo (stationary_chart) gives you an idea how a chart could be made with stationary axes while data are coming in; and when the x axis overflows  the entire chart is shifted to the left (otherwise the entire chart area would become black after a few seconds at 1000 samples/sec). Note that this version stores all data from the beginning which means that some slowdown is to be expected after some time. ---------------------------------------------------------------------- mas steindorff · 2019-04-29 00:24 nice and thank you, I'll give them a try  tomorrow ---------------------------------------------------------------------- mas steindorff · 2019-04-29 22:12 Hi WP, the stationary data demo you created is close but not quite what I'm after.  please correct me if I'm wrong but to get what I'm after I'll need.. create a lineseries with a fixed number of points to span the say "10 seconds" data window. for example, if I have a sample rate of 100 sps, I'll only have 1000 points.Once I have all 1000, I will need to replace  the 1st set of points or change their value.  so I if I simply change the Y values of a set of points and leave the X value, the x-axis should not roll/change.  I was going to change around 25 points each update so = 1/4 second.I would like the red line to move with this changing area zone. Is that simple to do with the "chart1Constantline" object you used?   if so, is it the .position that I would set = x xaxis values I'm updating?  I still have some homework to do to fully understand your example but it a good start pointing me in the direction I hope to go.  thank you. ---------------------------------------------------------------------- wp · 2019-04-30 11:20 The new demo hopefully comes closer. In order to have a predefined amount of data points I found it easiest to put the data into an array of x/y records (here t and Value). The array points are passed to the chart by a UserDefinedChartSource and its OnGetChartDataItem event. Before the timer is activated the array is dimensioned to the maximum data count (10000), and the UserDefinedChartSource sets its PointsNumber to the same value. All data point records are preoccupied with t = index (of course you can use anything else here). When the timer fires 1000 data points are created; their y value is written to the data array beginning after the last index occupied by the preceding event. When the array limit is reached writing jumps back to index 0. A bookkeeping variable is set to store the array index to be used by the next timer event. A TConstantLine series is moved to the position of the last array element. Getting the x axis labels right was a bit tricky because I wanted to keep the labels of the previous cycle above the ConstantLine but replace them with the current values below the ConstantLine. I used the OnMarkToText event of the bottom axis to replace the labels. Please note that the code provided is not completely general because it assumes at places that index and time value are the same. But you should get the general idea behind the code. ---------------------------------------------------------------------- mas steindorff · 2019-04-30 19:56 very nice.  In fact it's so simple I need to work at getting my head around it.  This is exactly what I was after.  Thank you WP