Articles in this section
Category / Section

How to maintain axis interval while zooming in UWP Charts?

This article explains how to configure the UWP Chart to maintain a specific axis interval while zooming. 

Step 1: Initialize the ChartZoomPanBehavior in the SfChart Behaviors collection to enable zoom and pan behavior.

<chart:SfChart>
. . .
    <chart:SfChart.Behaviors>
        <chart:ChartZoomPanBehavior />
    </chart:SfChart.Behaviors>
. . .
</chart:SfChart>


Step 2: On the Chart Axis, set the EnableAutoIntervalOnZooming property to False, and specify a fixed Interval value. This interval will remain constant during all zoom operations.

<chart:SfChart>
     . . .
    <chart:SfChart.PrimaryAxis>
        <chart:NumericalAxis Interval="5" EnableAutoIntervalOnZooming="False" />
    </chart:SfChart.PrimaryAxis>
 
    <chart:SfChart.SecondaryAxis>
        <chart:NumericalAxis />
    </chart:SfChart.SecondaryAxis>
 
    <chart:ColumnSeries ItemsSource="{Binding Data}"
                        XBindingPath="XValue"
                        YBindingPath="YValue" />
</chart:SfChart>

Output

A UWP Chart displaying data with an X-axis interval of 5 and a Y-axis interval of 20 before any zooming.

After zooming, the X-axis continues to display labels with an interval of 5 because of disabling auto interval on zooming. Concurrently, the Y-axis's interval is shown dynamically adjusted to the new zoom level.

After zooming, the X-axis continues to display labels with a constant interval.

 

Refer to the GitHub sample to examine the full working implementation.

Conclusion

Hope this article has provided a clear understanding of how to maintain a constant axis interval while zooming in the UWP Chart (SfChart).

You can refer to our UWP Charts feature tour page to know about its other groundbreaking feature representations. You can also explore our UWP Charts examples to understand how to present and manipulate data. 

For current customers, you can check out our WPF controls from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our UWP Charts and other UWP controls.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied