Repository navigation
Description
Before you start
- I searched the existing issues and the roadmap and did not find a duplicate request.
What problem does this solve?
A layout's chart frame draws one bar per feature of a numeric field, the 20 largest, in one fixed colour, titled with the field name. That only works for small layers and simple questions. A map page often needs a chart that summarises the layer instead: the population per continent, the number of sites per region, the mean value per class.
Today, several things go wrong without saying so:
- Bars past the 20th are dropped silently.
- Features with no number in the field are left out silently.
- Negative values are drawn as 1 px bars.
- An unknown
labelfield is ignored onlayout.addElement. labelcan't be changed withlayout.update, and the Format pane has no rows for a chart's layer, field or label.
Proposed solution
Four pull requests, each with its own project capability, so that older readers refuse a project they would draw differently.
- Data (
layout-chart-data)group: one bar per value of a field, withstatisticcount, sum, mean, min or max. Blank values make one "(blank)" bar. A count can chart a text field.order: largest first (the default), smallest first, by label A to Z, or layer order.bars: 1 to 100, 20 by default.- Past the limit, the user chooses: leave the rest out, with a warning, or gather them in a last "Other" bar (
other), which holds the same statistic over their features. - Negative values run from a zero line.
- Warnings say how many features have no number.
labelbecomes editable inlayout.update, and an unknown one is refused.- Format pane rows: Layer, Field, Group by, Statistic or Label, Order, Bars, Past the limit.
- Charts saved before draw to the same pixels.
- Look (
layout-chart-look): vertical or horizontal bars, values on the bars (thousands separated, a choice of decimals), a custom title or none, the bar colour, and labels set against the bars. - Classes (
layout-chart-classes): bars coloured by the layer's symbology classes, and bars stacked by a second field, with a key. - Facing charts (
layout-chart-facing): bars that run the other way (right to left, or down), a fixed maximum so that two charts share one scale, labels hidden, and a bar outline. Two charts side by side then compare two fields per category back to back, for example the share of businesses against the share of people in each district, with the category names between them.
The chart stays one drawing function, so the layout view, PNG, PDF and SVG exports all draw it the same way.
All four stay within the .rgis format 2, adding to it as the other layout options have since. A new option is written only when it differs from its default. Its capability goes into requires only when a project uses it. So a project with plain charts keeps its bytes and still opens in older releases, while one that uses the new options is refused there, naming the capability, instead of being drawn differently and saved without them.
Estimated scope
- Medium: a broader feature that is feasible in a reasonable timeframe
Alternatives considered
- Building the chart outside RustGIS and placing it as a picture: it doesn't follow the data, and it loses the layout's fonts and ink.
- A report's chart block: reports already group and aggregate, but their charts don't go on a layout page.
- One large PR: the model, the commands, the pane and four capabilities are easier to review in four steps.
- A single back-to-back chart element with two fields: it would duplicate the bar drawing for one layout. Two charts that can face each other also cover a chart that runs the other way on its own.
Activity
jgregoriorincon commentedon Nov 20, 2026
I'm working on this. Part 1 (data: group, statistic, order, bar limit, Other bar) is ready and its pull request follows shortly.
fix(layout): chart tallies per value, a literal (blank) bar apart, pi…
fix(layout): say chart bars whose statistic is past a number's range;…
fix(layout): hold chart group names once, look text up without copyin…
fix(layout): a counting chart moved to another layer takes its first …
feat(layout): charts group, order and cut their bars, or gather the r…
jgregoriorincon commentedon Nov 20, 2026
Part 1 was merged in #2489. I'm now working on part 2 (look: vertical bars, values on the bars with a choice of decimals, a custom title or none, the bar colour, and labels set against the bars), and its pull request follows shortly. I've also added a part 4 to the plan above: charts that can face each other, so that two of them side by side compare two fields per category back to back.
fix(layout): chart means of opposite signs, value scaling and title d…
fix(layout): chart bars past a number's range, and layout.update's ch…
feat(layout): a chart draws columns, writes its values, takes its own…
jgregoriorincon commentedon Nov 20, 2026
Part 2 was merged in #2537. I'm now working on part 3 (classes), in two pull requests so that each stays reviewable:
layout-chart-classes). A bar per feature takes its feature's class colour; a grouped bar takes the colour its features share, and keeps the chart's bar colour, with a warning, when they fall in several classes.layout-chart-stack, its own capability, so a reader that knows 3a refuses a stacked chart instead of drawing it flat).The pull request for 3a follows shortly.
fix(layout): a chart says which bars keep its bar colour because thei…
feat(layout): a chart's bars take their features' colours by the laye…
fix(layout): hidden features and images leave a chart bar to the colo…
fix(layout): a chart says which bars keep its bar colour because thei…
fix(layout): a chart's bars read their colours as the map frame draws…
fix(layout): a chart's notices read its bars' colours as the page dra…
feat(layout): a chart's bars take their features' colours by the laye…
feat(layout): a chart's bars stack by a second field, with a key (ope…
jgregoriorincon commentedon Nov 23, 2026
I'm now working on part 4 (facing charts), in two pull requests so that each stays reviewable:
mirror: right to left, or columns hanging down), a fixed maximum (max) so that two charts share one scale, and labels hidden (hideLabels). Capabilitylayout-chart-facing.barOutline), with a capability of its own (layout-chart-outline), so that a reader of 4a refuses a chart with an outline rather than drawing it without one.feat(layout): charts face each other: mirrored, on a fixed maximum, l…
feat(layout): a line round a chart's bars and between its stretches (o…
jgregoriorincon commentedon Nov 27, 2026
All of this plan is merged:
Each part added its own project capability (
layout-chart-data,-look,-classes,-stack,-facing,-outline).Two chart notices go beyond this plan and will get their own issue: saying a chart's notices again on export (#2824, "Not in this PR"), and a notice for a chart too small to draw (noted as a follow-up in #2537).
Closing as completed.