Transform axis value to pixel value and vice-versa

3 Sep 20201 minute to read

SfChart offers two utility methods to transform the pixel to chart point and vice-versa.

  • c#
  • double xValue = Chart.PointToValue(Chart.PrimaryAxis, screenPoint);
    double yValue = Chart.PointToValue(Chart.SecondaryAxis, screenPoint);
    double chartPointX = Chart.ValueToPoint(Chart.PrimaryAxis, xValue);
    double chartPointY = Chart.ValueToPoint(Chart.SecondaryAxis, yValue);

    Use the ValueToPoint and PointToValue methods, which are available in ChartAxis, to convert the screen point within the rendered area of the series.


    You can convert the actual axis value to 0 to 1 coefficient using the ValueToCoefficient(double value) and CoefficientToValue(double value) methods of ChartAxis.