Axis with fixed values on a stream

Oystein Bjorke 6 years ago 0
This discussion was imported from CodePlex

user78483 wrote at 2013-10-17 09:18:


is it possible to always show the latest defined range (via minimum and maximum) on a running stream?

I do have a continous stream adding values 1,2,3,4,5sec and so on. My x-axis should only show the last second. The labels should show 0 to 1 for example.

I can do this, always cutting the last second and changing x-values from 0 to 1, but this is not satisfactory.

Any idea how to do that? A plus would be if I can also zoom.

Thanks in advance

everytimer wrote at 2013-10-17 12:13:

Use the AxisChanged event. Capture the ActualMaximum of your axis and then assign the Minimum in accordance. Good luck

user78483 wrote at 2013-10-17 14:27:

Thanks everytimer for your quick response. But how to use the AxisChanged event? This does only fire if I zoom or pan not if the values increase.

I simply added the event like so:
var timeAxis = new LinearAxis(AxisPosition.Bottom, 0) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Title = "Time", Unit="s" };
timeAxis.AxisChanged +=timeAxis_AxisChanged;
So there is no min/max defined and the axis increases its values as needed.

I would like to get a (oscilloscope like) behaviour like this. That the X axis is fixed to a small window of 5 seconds of the newest data, here is an example: