selectionController property Null safety

RangeController? selectionController
final

Controller used to set the maximum and minimum values for the chart. By providing the selection controller, the maximum and The minimum range of selected series or points can be customized.

Widget build(BuildContext context) {
  final RangeController rangeController= RangeController(
    start: 1,
    end: 4
  )
  return SfRangeSelector (
    min: 1,
    max: 4,
    controller: rangeController,
    child: SfCartesianChart(
      series: <ColumnSeries<SalesData, num>>[
        ColumnSeries<SalesData, num>(
          dataSource: chartData,
          xValueMapper: (SalesData sales, _) => sales.x,
          yValueMapper: (SalesData sales, _) => sales.y,
          selectionController: rangeController
        ),
      ],
    )
  );
}
final List<SalesData> chartData = <SalesData>[
  SalesData(1, 23),
  SalesData(2, 35),
  SalesData(3, 19),
  SalesData(4, 29),
  SalesData(5, 50)
  SalesData(6, 77)
];

class SalesData {
  SalesData(this.x, this.y);
    final double x;
    final double y;
}

Implementation

final RangeController? selectionController;