Bar Chart

Loading preview

Starting the Flutter app

A Flutter bar chart in CustomPaint that switches between stacked and grouped columns, with channel filters and a per-week breakdown card.

Get the source

Add it to your project

Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.

First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.

_BarPainter reads _weeks and paints either stacked or grouped columns depending on _layout, capping bars at 24 pixels and rounding only the top ends. Colors are assigned by channel index rather than position, so hiding a channel never repaints the others. The axis step is recalculated from the visible channels, which keeps ticks round as filters change. Selection is simple band math in _selectAt, shared by hover, tap and drag. To adapt it, edit _channels and _weeks, keeping one value per channel in each week, and add a color to the list in build for every extra channel.