SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

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.