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
close icon

How to programmatically pan a ColumnSeries bar chart

I have a bar chart with a Numerical y-axis and a Category x-axis.

Due to the large number of categories on the x-axis, I had to implement scrolling using the following behaviour:

<chart:SfChart.Behaviors>
       <chart:ChartZoomPanBehavior EnablePanning="True"/>
</chart:SfChart.Behaviors>

and also setting the 'ZoomFactor' on the CategoryAxis appropriately.

This works great, and you can scroll along with the mouse or by touch. However I also need to scroll the chart programmatically. So for example if I have a ZoomFactor of 0.5, I can see the first 50% of the bars. I want to then programmatically show the second 50% of the bars (i.e. without using the mouse or touch).

I can't see how to do this, so any help would be appreciated.

1 Reply

MK Magesh Kumar Krishnan Syncfusion Team November 25, 2014 01:05 PM UTC

Hi Mark,

Thanks for using Syncfusion products.

 

SfChart provides the API called ZoomPosition for panning, we can use this property for programmatic panning requirement. It takes the values from 0 to 1. You can define the ZoomPosition property as in below code snippet.

 

Code snippet:

 

<chart:CategoryAxis Name="primaryAxis" EnableScrollBar="False" ZoomFactor="0.3" ZoomPosition="0.5" FontSize="20">

  </chart:CategoryAxis>

 

Please refer the link given below.

Link : http://help.syncfusion.com/ug/wpf/default.htm#!documents/zoomingandpanning.htm

 

We have prepared sample based on your requirement . please find the sample in the attachment.

Please let us know if you have any queries .

 

Thanks,

Magesh Kumar K


Attachment: ZoomPosition_af7f114a.zip

Loader.
Live Chat Icon For mobile
Up arrow icon