Chartview - reset zoom

4 posts, 0 answers
  1. Shaun
    Shaun avatar
    18 posts
    Member since:
    May 2012

    Posted 26 Jul 2012 Link to this post

    Greetings,

    I would like to programmatically reset the zoom level (undo all zooming) on a RadCartesianChart.  What is the recommended way to handle that?

    I have tried
    radChartView.Zoom = new Size(1,1);

    as well as

    radChartView.Zoom = Size.Empty;

    And both result in incorrect / awkward behavior.

    Thanks,
    Shaun
  2. Shaun
    Shaun avatar
    18 posts
    Member since:
    May 2012

    Posted 26 Jul 2012 Link to this post

    Side note:  This will happen when the dataset is changed.

    Example: 

    • The user has selected May 1, 2012.  
    • The graph is updated to show 1000 data points throughout the day
    • The user zooms in to take a closer look
    • The user changes days and chooses May 2, 2012

    At this point, I want to reset the zoom of the chart and display data for May 2.

    My current method of hooking into the DataSource changing and setting zoom to 1,1 at that point doesnt seem to work (very buggy, arbitrary date ranges are shown, scrollbar is weird)

  3. DevCraft banner
  4. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 31 Jul 2012 Link to this post

    Hi Shaun,

    Besides resetting the zoom, you need also to reset the panning. You need to do the two things together.
    chartView.Zoom = new Size(1, 1);
    chartView.PanOffset = new Point(0, 0);
    I hope this will help you to achieve the desired effect.


    Greetings,
    Rosko
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Shaun
    Shaun avatar
    18 posts
    Member since:
    May 2012

    Posted 31 Jul 2012 Link to this post

    Perfect, thanks!
Back to Top