seriesRenderer property

dynamic seriesRenderer
final

Get the current series.

SfCartesianChart(
 onDataLabelRender: (DataLabelRenderArgs args) {
   CartesianSeriesRenderer<dynamic, dynamic> series = args.seriesRenderer;
 //Changed the background color of the data label based on the series type
     if (series.name == 'Product A') {
       args.color = Colors.blue;
     } else if(series.name == 'Product B'){
       args.color = Colors.red;
     }
   },
 )

Note: Series type may vary based on the chart type.

  • Cartesian chart: CartesianSeries series;
  • Circular chart: CircularSeries series;
  • Funnel Chart: FunnelSeries series;
  • Pyramid Chart: PyramidSeries series;

Implementation

final dynamic seriesRenderer;