Trigger ChartView Auto X/Y Rescale

2 posts, 0 answers
  1. Scott
    Scott avatar
    31 posts
    Member since:
    Aug 2011

    Posted 23 Jun 2017 Link to this post

    I am allowing the user to pan & zoom on the graph, for example through the following:

    ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;

    At some point, I set the ScrollMode back to ScrollMode.None and want to reset the ranges of the X & Y axes. I want the ranges to be calculated in the fashion they were when the data were originally drawn.

    How can I get the ChartView to recalculate the axis ranges?

    Please note that I may add data to the chart before triggering the recalc so just remembering range values before pan/zoom and setting them afterwards won't be sufficient.

  2. Martin Ivanov
    Martin Ivanov avatar
    1549 posts

    Posted 28 Jun 2017 Link to this post

    Hi Scott,

    I think the zoom range start/end properties will work for your case. The properties are HorizontalZoomRangeStart, HorizontalZoomRangeEnd, VerticalZoomRangeStart and VerticalZoomRangeEnd. You can learn more about them in the Scroll and Zoom article. To reset the zoom level you can set the start property to 0 and the end to 1.

    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top