Zooming in C1Chart

To add zooming behavior in C1Chart, use some custom code in the Chart's MouseWheel event.

private void chart_MouseWheel(object sender, MouseWheelEventArgs e)

{    

      if (Keyboard.Modifiers == ModifierKeys.Control && e.Delta == -120)    

      {

       chart.View.AxisX.Scale += .1;

       chart.View.AxisY.Scale += .1; 

       }

else if (Keyboard.Modifiers == ModifierKeys.Control && e.Delta == 120)

      {

          chart.View.AxisX.Scale -= .1;

          chart.View.AxisY.Scale -= .1;    

          }

}

 

To enable the user to move the chart around when it’s zoomed, add the following to C1Chart’s XAML:

 

 <c1c:C1Chart x:Name="chart" MouseWheel="chart_MouseWheel" >

    <c1c:C1Chart.Actions>

         <c1c:TranslateAction MouseButton="Left" />

    </c1c:C1Chart.Actions>

</c1c:C1Chart>

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.