Pre loader

Pan via code

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

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.

  1. How should I specify a given timeSpan range for the XaxisVisibleRange?
  2. How should I validate that the new timeSpan range is within the range of the underlying dataSeries?
  • You must to post comments
0
0

Hey there,

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!

Andrew

  • You must to post comments
0
0

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!

Andrew

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies