Chart layout
Choose the chart from the customer’s question. These are customer-facing spending summaries, not an operational dashboard.
Your app loads the data, chooses the ChartState, and supplies every amount, headline, delta and verdict.



The full-screen phone captures show one viewport. Transaction rows and, at 200% text, part of the method breakdown continue below it.
Choose a chart
Section titled “Choose a chart”| Question | Component | Watch out for |
|---|---|---|
| Going up or down? | Line | A zoomed axis emphasizes change, so read the tick labels. |
| How much each? | Bar | Starts at zero; small differences may disappear. |
| Breakdown of a total? | Meter | One snapshot, up to five categories. |
| Quick trend? | Sparkline | No precise values or axes. |
The container owns height: 180 for compact plots, 320 for featured plots. Meter charts use intrinsic height. Show the host headline first. On a history screen the list comes first and the spending summary follows it; the gallery specimen “In context: spending above history” shows the chart module itself. At most three plots belong in one row, each around 200px or wider; stack them on phones.
Row(children: [ Expanded(child: ChartModule( title: 'Weekly spending', state: ChartState.ready, headline: const Money.idr(1080000), headlineCaption: 'Settled', chart: PaymentBarChart(points: weeklyPoints), )), const SizedBox(width: 16), Expanded(child: ChartModule( title: 'Trend', state: ChartState.ready, chart: PaymentLineChart(points: weeklyPoints), )),]);States
Section titled “States”Choose loading before error, error before empty, then ready. ChartModule keeps the plot height stable across these states; the headline is outside the plot. Error and empty messages scroll at large text so the retry action remains reachable.
Reading the exact amount
Section titled “Reading the exact amount”Line and bar charts show one exact value at rest: the latest settled period is selected, with a guide line up to a label above the plot (“29 Okt · Rp420.000”). Tap or drag to read another period. The y-axis gutter grows with its scaled labels, so “Rp600K” never touches the plot at 200%. Above 1.5× text the module caps the plot at ChartModule.compactHeight, so the rows under a chart stay on the first screen of a small phone.
The payment boundary
Section titled “The payment boundary”Pending uses dashed/outlined marks. Unknown uses dotted/hatched marks. Missing data leaves a gap. Only settled values enter the generated lowest/highest/latest summary. Headlines are host-provided Money values; the kit never computes totals. The meter legend formats the selected unit: money, percent or number.
Content guidelines
Section titled “Content guidelines”Give periods short labels and qualify a headline as settled when needed. Keep currencies consistent. Use compact formatting for axes only, never a payment confirmation.
Accessibility
Section titled “Accessibility”The chart summary announces the same latest amount the label shows, so nothing depends on selection. At narrow widths, fewer visual axis labels preserve space. Supply a complete semanticLabel when your host needs additional context.
ChartModule
class ChartModule extends StatelessWidget · lib/src/charts/charts.dart
A chart section with stable loading, empty and error states.
| Parameter | Type | Default | Description |
|---|---|---|---|
title:required | String | — | Title. |
state:required | ChartState | — | State. |
chart: | Widget? | — | Chart. |
headline: | Money? | — | Host-provided amount. The kit never computes a headline total. |
headlineCaption: | String? | — | Headline Caption. |
showHeadline: | bool | true | Show Headline. |
delta: | String? | — | Delta. |
deltaTone: | StatusTone | StatusTone.neutral | Delta Tone. |
height: | double? | compactHeight | Height. |
emptyTitle: | String? | — | Empty Title. |
emptyMessage: | String? | — | Empty Message. |
errorMessage: | String? | — | Error Message. |
onRetry: | FutureOr<void> Function()? | — | On Retry. |
trailing: | Widget? | — | Trailing. |
ChartState
enum ChartState · lib/src/charts/chart_models.dart
Host-owned chart loading state.
| Value | Description |
|---|---|
loading | Fetch in progress. |
ready | Data available. |
empty | No data available. |
error | Fetch failed. |
ChartPoint
class ChartPoint · lib/src/charts/chart_models.dart
One period reading, with missing values distinct from zero.
| Parameter | Type | Default | Description |
|---|---|---|---|
label:required | String | — | Visible period or category label. |
value: | Money? | — | Null is missing data, never zero. |
status: | ChartPointStatus | ChartPointStatus.settled | Settlement state; never encoded by a series color. |
spokenLabel: | String? | — | Optional expanded period name for spoken summaries. |
measure: | num? | — | Host-computed quantity; null is missing data. |
ChartPointStatus
enum ChartPointStatus · lib/src/charts/chart_models.dart
Settlement state of a reading.
| Value | Description |
|---|---|
settled | Confirmed reading. |
pending | Awaiting confirmation. |
unknown | Not yet confirmed. |
MeterSegment
class MeterSegment · lib/src/charts/chart_models.dart
One non-negative category in a meter.
| Parameter | Type | Default | Description |
|---|---|---|---|
label:required | String | — | Visible period or category label. |
value: | Money? | — | Money reading when using currency units. |
status: | ChartPointStatus | ChartPointStatus.settled | Settlement state; never encoded by a series color. |
measure: | num? | — | Host-computed non-negative quantity. |
See also
Section titled “See also”- Line chart, bar chart, meter chart, sparkline.
- Layout guidance adapted from Stripe’s chart layout pattern.
Comparing periods
Section titled “Comparing periods”The headline region derives from the scaled amount line, caption line and section gap. Named series share period labels and one scale:
PaymentLineChart(series: const [ PaymentChartSeries(label: 'This month', points: [ ChartPoint(label: 'Week 1', value: Money.idr(350000)), ]), PaymentChartSeries(label: 'Last month', points: [ ChartPoint(label: 'Week 1', value: Money.idr(280000)), ]),]);