onRendererCreated property

SeriesRendererCreatedCallback? onRendererCreated
final

Triggers when the series renderer is created.

Using this callback, able to get the ChartSeriesController instance, which is used to access the public methods in the series.

Defaults to null.

Widget build(BuildContext context) {
  ChartSeriesController? _chartSeriesController;
  return Column(
    children: <Widget>[
      SfCartesianChart(
        series: <LineSeries<SalesData, num>>[
          LineSeries<SalesData, num>(
            onRendererCreated: (ChartSeriesController controller) {
              _chartSeriesController = controller;
            },
          ),
        ]
      ),
      TextButton(
        child: Text("Animate series"),
        onPressed: () {
          _chartSeriesController?.animate();
        }
      )
    ]
  );
 }

Implementation

final SeriesRendererCreatedCallback? onRendererCreated;