Charts & pivot
Chart
Companion widget over the grid's filtered rows; re-reads on every change.
BCellChart(
stateManager,
type: BCellChartType.bar, // line / bar / pie / area / scatter / radar / stackedBar
categoryField: 'month',
valueFields: const ['sales', 'cost'],
)
Pivot
Pure read; group rows into a matrix, render the result in a second grid.
final p = sm.pivot(
rowField: 'region', columnField: 'quarter', valueField: 'sales',
aggregate: BCellPivotAgg.sum, // sum / count / average / min / max
);
p.value('West', 'Q1'); p.rowTotal('West'); p.grandTotal;
final g = p.toGrid(); // -> (columns, rows) for a second BCellGrid
Multi-level fields (nested keys), a % of total value mode, and a key
comparator:
sm.pivot(
rowFields: ['region', 'city'], // List<String> -> nested row keys
columnField: 'quarter', valueField: 'sales',
aggregate: BCellPivotAgg.sum,
valueMode: BCellPivotValueMode.percentOfTotal, // cells as % of grand total
keyComparator: (a, b) => a.compareTo(b), // sorted keys
);