I have a chart with dynamically added Data. But only want to display for example the last 50 entries.
My x values are incrementing every time by 1. How do I modify my chart or my series for that?
EDIT 1: And the chart should not display the x- value zero. it should "slide" along with the values. As example you got x values from 0 to 2000. then the graphs x axis should start by 1950 and end with 2000. That you can read all data and stop it from zooming out.
(EDIT 2: Changing range of the x axis frequently wont work because on the one hand it isn't anywhere near a smooth chart and on the other cost very much performance.)
EDIT 3:
first I had an int = x
which incremented every milliseconds (or less) and was displayed in the chart. those big numbers where the problem which slowed my performance. I now changed to double = x
which incremented every milliseconds by 0.001 -> so x was in seconds. and with these small numbers it works smoothly
Thank you
Just remove the first element of your Series
:
series.getData().remove(0);