We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set zoom and pan position for WPF Chart (SfChart)?

Platform: WPF |
Control: SfChart |
.NET Framework: 4.5 |
Product Version: 12.1.0.43
Tags: chart, pan, zoom

WPF Chart (SfChart) allows you to zoom the chart area by using ZoomFactor and ZoomPosition properties. The ZoomFactor property defines the zooming level and the ZoomPosition property defines the zooming (scrolling) position for chart. Both values should fall between 0 and 1.

For instance, when ZoomFactor is 0.5 and ZoomPosition is also set to 0.5 for the chart with 10 data points, it shows last 5 data points in chart. Here, ZoomFactor decides no of points (5), and ZoomPosition decides range of values to display (from 6 to 10).

C#

private void MyChart()
{
  SfChart chart=new SfChart();
  chart.PrimaryAxis=new CategoryAxis();
  chart.PrimaryAxis.ZoomPosition = 0.7;
  chart.PrimaryAxis.ZoomFactor = 0.3;
  ChartBehavior behavior= new ChartZoomPanBehavior();
} 

 

Zooming in WPF Chart

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment
Comments
Gabriele Resmini
Nov 15, 2017

In Android I was using ZoomFactor and Zoom position as value bound to my viewmodel and all seems to work.

In iOS seems that I need to set them via code behind, otherwise they don't work as expected.

Can you check it?

Thank you


Reply

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile