SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
I am using SciChart for WPF version 184.108.40.2067 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?
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:
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:
/// <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();
/// <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);
/// <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.
Please login first to submit.