sortingOrder property

SortingOrder? sortingOrder
final

The data points in the series can be sorted in ascending or descending order. The data points will be rendered in the specified order if it is set to none.

Default to SortingOrder.none.

Also refer SortingOrder.

Widget build(BuildContext context) {
  return SfCartesianChart(
    series: <ColumnSeries<SalesData, num>>[
      ColumnSeries<SalesData, num>(
        dataSource: chartData,
        xValueMapper: (SalesData sales, _) => sales.x,
        yValueMapper: (SalesData sales, _) => sales.y,
        sortFieldValueMapper: (SalesData sales, _) => sales.x,
        sortingOrder: SortingOrder.descending
      ),
    ],
  );
}
final List<SalesData> chartData = <SalesData>[
  SalesData(1, 23),
  SalesData(2, 35),
  SalesData(3, 19)
];

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

Implementation

final SortingOrder? sortingOrder;