Articles in this section
Category / Section

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

1 min read

Description

This article explains how to zoom the chart area of a WPF SfChart by using the ZoomFactor and ZoomPosition properties of the chart axis.

  • ZoomFactor specifies the zoom level (range of data to display), with a value between 0 and 1.
  • ZoomPosition specifies the starting position of the zoomed range, also between 0 and 1.

Example scenario 

Consider a chart with 10 data points:

  • When the zoom factor is set to 0.5, the chart displays 50% of the total data points — in this case, 5 out of 10.
  • When the zoom position is set to 0.5, the visible range starts halfway through the data.

So, the chart displays data points from position 6 to 10.

Refer to the following code example.

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();
} 

Output


Zooming in WPF Chart

 

Conclusion

I hope you enjoyed learning about how to set zoom and pan position for WPF Chart (SfChart).

You can refer to our WPF Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WPF Chart example to understand how to create and manipulate data.

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

If you have any queries or require clarifications, please let us know in the comments section 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
Please  to leave a comment
Access denied
Access denied