SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!
Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.
I’d like to Pan a chart with a DateTime xAxis some number of seconds (or bars) through code. It looks like the IRange for the chart rationalizes to so I somehow need to be able to convert a TimeSpan to an appropriate range I can use and set the XaxisVisibleRange. If there is an example I’m missing it.
Do you have a source code license? If so take a look at the code for ZoomPanModifier.cs. This is quite complex but shows how to scroll in the X-direction programmatically, using a combination of VisibleRange calculations and the IAxis.ScrollTo() method.
If not – hold tight, we have re-worked the interactivity API and will be publishing / exposing it for the next major version!
Actually, I tell a lie, it is possible to do this now using the IAxis.ScrollTo method. Here’s a code sample
double numberOfPixelsToScroll = 40; var beforeRange = (IRange)XAxis.VisibleRange.Clone(); XAxis.ScrollTo(_startVisibleRange, numberOfPixelsToScroll); var afterRange = XAxis.VisibleRange;
Basically the ScrollTo() method takes a start range & applies a number of pixels to scroll to. This works for all axis types on the X-Axis.
Note: this API is v1.5 specific and will change in v2.0.
I hope this helps!
Please login first to submit.