onCreateRenderer property
Used to create the renderer for custom series.
This is applicable only when the custom series is defined in the sample and for built-in series types, it is not applicable.
Renderer created in this will hold the series state and this should be created for each series. onCreateRenderer callback function should return the renderer class and should not return null.
Series state will be created only once per series and will not be created again when we update the series.
Defaults to null
.
Widget build(BuildContext context) {
return Container(
child: SfCircularChart(
series: <PieSeries<SalesData, num>>[
PieSeries<SalesData, num>(
onCreateRenderer: (ChartSeries<SalesData, num> series) {
return CustomPieSeriesRenderer(
series as PieSeries<SalesData,num>);
),
],
)
);
}
class CustomPieSeriesRenderer extends PieSeriesRenderer<SalesData, num> {
CustomPieSeriesRenderer(this.series);
final PieSeries<SalesData, num> series;
}
Implementation
// custom implementation here...
/// }
/// ```
final ChartSeriesRendererFactory<T, D>? onCreateRenderer;