totalSumPredicate property Null safety

ChartIndexedValueMapper<bool>? totalSumPredicate
final

A boolean value, based on which the data point will be considered as total sum or not.

If this has true value, then that point will be considered as a total sum. Else if it has false, then it will be considered as a normal data point in chart.

This callback will be called for all the data points to check if the data is total sum.

Note: This is applicable only for waterfall chart.

Defaults to null.

Widget build(BuildContext context) {
   return Container(
       child: SfCartesianChart(
           series: <WaterfallSeries<SalesData, num>>[
               WaterfallSeries<SalesData, num>(
                dataSource: <SalesData>[
                   SalesData(2, 24, true),
                   SalesData(3, 22, true),
                   SalesData(4, 31, false),
                ],
               xValueMapper: (SalesData sales, _) => sales.x,
               yValueMapper: (SalesData sales, _) => sales.y,
               totalSumPredicate: (SalesData data, _) => data.isTotalSum,
             ),
            ],
       ));
}
class SalesData {
  SalesData(this.x, this.y, this.isTotalSum);
  final num x;
  final num y;
  final bool isTotalSum;
}

Implementation

final ChartIndexedValueMapper<bool>? totalSumPredicate;