seriesRenderer property

dynamic seriesRenderer
final

Get the current series.

SfCartesianChart(
   onDataLabelRender: (DataLabelRenderArgs args) {
     CartesianSeries<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<dynamic, dynamic> series;
  • Circular chart: CircularSeries<dynamic, dynamic> series;
  • Funnel Chart: FunnelSeries<dynamic, dynamic> series;
  • Pyramid Chart: PyramidSeries<dynamic, dynamic> series;

Implementation

final dynamic seriesRenderer;