This is a migrated thread and some comments may be shown as answers.

Changing Zoom from Code

2 Answers 186 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 22 Mar 2012, 03:00 PM
I am using the ChartView control, and would like to be able to change the Zoom from code.
I have tried two things.

1. Set Zoom property directly from code.
i.e. Chart.Zoom = new Size(1,1);

2. Bind to a Zoom property on my view model, and set that property.

i.e. XAML gets

   <telerik:RadCartesianChart Name="Chart" Zoom="{Binding Path=Zoom, Mode=TwoWay}">

And code gets
     ViewModel.Zoom = new Size(1,1);

Either way, the view is not refreshed correctly.  However, on a re-size operation, it becomes OK again.

Is this a known problem, or is there something else I need to do?

Thanks
Craig Littlewood

2 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 27 Mar 2012, 08:02 AM
Hello Craig,

We assume you are trying to reset the pan/zoom state after the user has applied some pan/zoom actions with the mouse -- you can achieve the desired effect like this:
private void ResetPanAndZoomState()
{
    RadChart1.Zoom = new Size(1, 1);
    RadChart1.PanOffset = new Point(0, 0);
}

Hope this helps.


All the best,
Giuseppe
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Craig
Top achievements
Rank 1
answered on 27 Mar 2012, 10:20 AM
Giuseppe  

I can confirm this resolved the problem.

Thanks and regards
Craig
Tags
ChartView
Asked by
Craig
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Craig
Top achievements
Rank 1
Share this question
or