'Using c# winform Live-Charts, how to make real time plot with changing data?

My data is coming from a real time source that provides a number of milliseconds from start and the value. I want a real time plot, i.e. the old values fall of the left side. I want the x axis to show the time as "last 20 seconds" worth and not the actual time. I have tried min and max x value settings, which seem to be close to my solution, but the x axis will change values since the x value is always increasing.

One idea is to replace all the previous x values with new time adjusted ones when a new one comes in, but I am not quite sure how to do that correctly.

Another possibility is to change to a zoom, pan but I am not sure that really meets the needs of just seeing the last 20 seconds worth of values.

What would be a way to accomplish my requirement?

[Updated] Be sure any solutions suggested keep the x axis static. The referenced topic has the values moving with the data.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source