pixelToPoint method

ChartPoint pixelToPoint(
  1. Offset position
)

Converts logical pixel value to the data point value.

The pixelToPoint method takes logical pixel value as input and returns a chart data point.

late CircularSeriesController seriesController;
SfCircularChart(
   onChartTouchInteractionDown: (ChartTouchInteractionArgs args) {
    ChartPoint<double> chartPoint = seriesController.pixelToPoint(args.position);
    Offset value = seriesController.pointToPixel(chartPoint);
  },
  series: <PieSeries<SalesData, String>>[
    PieSeries<SalesData, String>(
      onRendererCreated: (CircularSeriesController controller) {
        seriesController = controller;
      }
    )
  ]
)

Implementation

ChartPoint<dynamic> pixelToPoint(Offset position) {
  final CircularSeriesRendererExtension renderer =
      seriesRenderer as CircularSeriesRendererExtension;
  return circularPixelToPoint(position, renderer.stateProperties);
}