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


I want to set the gap between top and bottom of the axis with respect to the data for example if my data range is between 3 to 15 then i want to set the visible range 2 to 16 like that.The same is happened when the chartsurface.zoomextents(),how the offset is calculated,how can i set manually?. Please see the attached images how can i set the same gap as manually like zoomextents.

  • You must to post comments

Good morning Raghupathy,

In order to add a gap above/below data always, firstly you can use AxisBase.GrowBy. This adds a fractional amount above and below the data when auto-ranging or zooming to extents. For instance:

// Adds 10% below Min and 20% above Max
AxisBase.GrowBy = new DoubleRange(0.1, 0.2);

If you require precise control over the Axis VisibleRange on zoom extents, you will need to override AxisBase.GetMaximumRange()

public class CustomAxis : NumericAxis
    public override IRange GetMaximumRange()
        var baseRange = base.GetMaximumRange() as DoubleRange;

        // Always return a range with +/- 1 padding
        return new DoubleRange(baseRange.Min - 1, baseRange.Max + 1);

Best regards,

  • Raghupathy
    Thank you Andrew it helps a lot.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.