Methods in Flutter Pyramid Chart (SfPyramidChart)

16 Oct 20232 minutes to read


Converts logical pixel value to the data point value.

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

Note: The method will return the center value of the segment.

//Initialize the series controller
    PyramidSeriesController? seriesController;

    Widget build(BuildContext context) {
      return Container(
        child: SfPyramidChart(
          onChartTouchInteractionDown: (ChartTouchInteractionArgs args) {
            final Offset value = Offset(args.position.dx, args.position.dy);
            final PointInfo<dynamic>? chartPoint = seriesController?.pixelToPoint(value);
          series: PyramidSeries<ChartData, String>(
            dataSource: data,
            onRendererCreated: (PyramidSeriesController pyramidSeriesController) {
              seriesController = pyramidSeriesController;
            xValueMapper: (ChartData data, _) => data.x,
            yValueMapper: (ChartData data, _) => data.y

    class ChartData{
      ChartData(this.x, this.y);
      final String x;
      final double y;