Pre loader

ZoomExtents() on just one Line Series

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

Answered
1
0

I am using SciChart for WPF version 1.3.1.1107 with the MVVM pattern.

I have a chart with several lines and I would like to zoom to extents on just one of the lines. Can you please suggest how I can zoom my chart to the extents of one of several lines that exist in a chart?

  • You must to post comments
Best Answer
1
0

I’m afraid this isn’t possible in v1.3 of SciChart but in v2.0 or greater we introduced Multiple X,Y Axis feature.

What you would have to do is register the series on a separate X,Y Axis and zoom that X,YAxis to extents by using our Axis Interactivity API.

For a demo of Multiple X and Y Axis, please see here:
http://http://www.scichart.com/Abt.Controls.SciChart.SL.ExampleTestPage.html#/Abt.Controls.SciChart.Example;component/Examples/IWantTo/ModifyAxisBehaviour/MultipleXAxes.xaml

You will notice the series can be scaled separately by dragging the Y and X Axes.

Next, you can look at our Axis Interactivity APIs and Axis Members to find methods to control that specific axis.

Here are functions throughout the API which can assist in getting axis ranges to perform zoom to fit. For instance:

AxisBase.GetMaximumRange

/// <summary>
/// Gets the Maximum Range of the axis, which is equal to the DataRange including any GrowBy factor applied
/// </summary>
/// <returns></returns>
public abstract IRange GetMaximumRange();

DataSeries.GetWindowedYRange(IRange visibleXRange)

/// <summary>
/// Gets the YRange of the data (min, max of the series) in the input visible range point range, where the input range is the <see cref="IAxis.VisibleRange"/>
/// </summary>
/// <param name="xRange">The X-Axis Range currently in view</param>
/// <returns>The YRange of the data in this window</returns>
/// <exception cref="System.ArgumentNullException">xRange</exception>
/// <exception cref="System.InvalidOperationException">Invalid Range Type. Please ensure you are using DateTimeAxis where the X-Data is DateTime, and NumericAxis where the X-Data is Double, Float, Int, Long</exception>
public IRange GetWindowedYRange(IRange xRange);

DataSeries.GetWindowedYRange(IndexRange indicesRange)

/// <summary>
/// Gets the YRange of the data (min, max of the series) in the input IndexRange, where indices are point-indices on the DataSeries columns
/// </summary>
/// <param name="xIndexRange">The X-Axis Indices currently in view</param>
/// <returns>
/// The YRange of the data in this window
/// </returns>
public IRange GetWindowedYRange(IndexRange xIndexRange);

Also if you’re interested in writing custom zoom to fit, I would suggest looking at the source code (which you have access to), SciChartSurface.ZoomExtents(), ZoomExtentsY() methods as these have custom logic in them to determine zoom to fit on a per-axis basis.

Images
  • You must to post comments
Showing 1 result
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