C1Chart for WPF offers a great feature in terms of zooming for better view-ability of a particular area of the chart.

In this blog, we will discuss how to retrieve the 'Displayed' Min & Max Values of an Axis object after performing Zooming in C1WPFChart.

After zooming the chart object, the 'Actual' Min & Max Values are never modified.
Therefore, to retrieve the 'Displayed' Min & Max values for the Axis object, we will perform a simple calculation using the ActualMin, ActualMax, Value & Scale properties of the respective Axis object.

  • Create a static Class

  • The Static class's methods will return the 'Displayed' Max & Min values for an Axis object



public static class AxisExtension
{

public static double GetDispMin(this Axis axis)
{

return axis.ActualMin + axis.Value *

(axis.ActualMax - axis.ActualMin) * (1 - axis.Scale);

}

public static double GetDispMax(this Axis axis)
{

return axis.ActualMax - (1 - axis.Value) *

(axis.ActualMax - axis.ActualMin) * (1 - axis.Scale);

}

}


Click the image below to have a better understanding :
C1WPFChartZoom_MinMax

Download Sample CS
Download Sample VB