Search code examples
flutterdartsyncfusion

Flutter Syncfusion SfCircularChart custom double value


I want to have a custom maximumValue per ChartData so that each chart has its own value.

the ChartData looks like this (adding totalCount setter)

class ChartData {
  ChartData(this.x, this.y, [this.totalCount]);
  final String x;
  final double y;
  final double? totalCount;
}

then its data instantiator

 final chartData = [
      ChartData('ONE', 3, 20),
      ChartData('TWO', 10, 100),
    ];

then in the implementation when I want to add the totalCount from the ChartData like this:

SizedBox(
   height: 300.0,
   child: SfCircularChart(series: <CircularSeries>[
   // Renders radial bar chart
   RadialBarSeries<ChartData, String>(
      dataSource: chartData,
      xValueMapper: (ChartData data, _) => data.x,
      yValueMapper: (ChartData data, _) => data.y,
      maximumValue: (ChartData data, _) => data.totalCount,)
  ])),

I get the message that:

The argument type 'double? Function(ChartData, dynamic)' can't be assigned to the parameter type 'double?'

so how do I get the double value totalCount to populate the maximumValue with a double value and not a Function(ChartData, dynamic)

I've looked around but can't find an answer. Is this possible?


Solution

  • seeing as I'd need some kind of maximumValueMapper , this is not available in a closed source package such as syncfusion.

    closing