PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Limiting a Chart with a fixed number of data points
Limiting a Chart with a fixed number of data points
Iniciado por guest, 29,ago. 2015 02:46 - 2 respuestas
Publicado el 29,agosto 2015 - 02:46
Hello:

I have a Chart showing new data every second, but I want to show the last 50 data values, so basically once I get the limit, every time I add a new value, I should delete the first one, but of course shift left the whole series to accommodate the new value.
So far, all examples I checked are adding values indefinitely, and the chart gets very ugly.

Any idea?
Thanks
Michael
Publicado el 29,agosto 2015 - 03:19
I was able to do it, but using an array with the dimension of the max. number of data points I want, and then for each new value I have to shift all data down (data in position 2 copy into 1, pos 3 to 2, etc.) but this is kind of slow for large arrays....
I'm wondering if there is a better way of doing this...


Regards;
Michael
Publicado el 29,agosto 2015 - 13:19
Hi Michael,

an array is a good solution, but:
- instead of shifting each value one step, just delete line one (arraydelete) and add line 50
- block the refresh of the window while you are doing that

it should be much faster

Best regards