Our charts receives data over time, so the visual range is continuously updated. This has effects on zooming since it also changes the visual range. So when the user tries to zoom at a part of the chart, the chart goes back to “normal” when a new sample is received (hence moving the time window). How do you solve this problem? I haven’t found any property that can tell me whether the user has zoomed the chart or not.
- btsvennes asked 11 years ago
- You must login to post comments
Hi there,
Many people have used this as a way of solving this problem:
- On MouseDown, disable AutoRange on the X and Y Axis of SciChart
- On Mouse DoubleClick, enable AutoRange on the X and Y Axis of SciChart
This has the effect that when you mouse-down to zoom, the axis visiblerange stops updating in response to new data-points. Then, when the zoom is performed, the chart is frozen at that point in time. Finally, when you double click, the chart not only zooms to extents but autorange is re-enabled, so it continues to fit the data.
Another different technique is to not use AutoRange, but to manually update the VisibleRange of the chart, depending on whether the last point of the DataSeries is inside the viewport or not. Please see the article How to have a Fixed Scrolling Time-Range on the XAxis that works with Modifiers which explains how we achieved this in the Real Time Stock Charts example example.
Try that example -> Zoom in to the chart and then double click to zoom back out. It only updates the chart’s XAxis and YAxis VisibleRange when not zoomed.
Best regards,
Andrew
- Andrew Burnett-Thompson answered 11 years ago
- Thank you. I've implemented something similar, but it's nice to know I wasn't that far of the track :-)
- Hi Regarding first section of the post. We have a request for similar functionality to be used for our realtime view. Where we want the X Axis labels(in our case showing time) to be stationary, just updating time. While the pens are moving along as new data is added. As opposed to the example from btsvennes, we show the current time not a fixed timespan (02:00 – 00:00). Is this possible.
- You must login to post comments
Hi Btsvennes,
Can you posted your code please to resolve this problem because i have the same problem but i don’t found a solution for this : always when i make the zoom the chart goes back to “normal” when a new sample is received !!
And thank you !
Sahar
- sahar Les answered 10 years ago
- You must login to post comments
Please login first to submit.