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?
When working with layers whose interesting quantity is a composition split across several
attribute columns, it is hard to read that composition on the map, because every renderer in
RustGIS today (Renderer in crates/map/src/symbology.rs) maps a feature to a single symbol
driven by at most one field:
- Single Symbol: no field;
- Unique Values: one categorical field;
- Graduated Colors: one numeric field;
- Proportional: one numeric field.
Concrete case: a polygon layer of administrative units with a male and a female population
column.
| region | pop_male | pop_female |
|---|---|---|
| A | 52,000 | 48,000 |
| B | 30,000 | 45,000 |
There is no way to show, per feature, "52% male / 48% female" and keep the total magnitude
readable. Graduated can colour by one ratio; Proportional can size by one total; neither shows
the make-up of each feature in place, and no combination of the two does either. The same gap
hits votes per party per precinct, land-use shares per parcel, or age cohorts per municipality.
This is a long-standard capability in mainstream desktop GIS:
- ArcGIS Pro ships it built-in as Chart symbology (Symbology → Primary symbology →
Chart: Bar/Stacked or Pie, driven by multiple numeric fields, with optional normalisation by
field or percent of total, background symbol, outline, and size varying by attribute). ArcMap
had the same Chart renderer for two decades, so.lyr/.lyrx/.aprxprojects in the wild
depend on it. https://doc.esri.com/en/arcgis-pro/latest/help/mapping/layer-properties/chart-symbology.html - QGIS ships it as the layer's Diagrams tab (Pie / Text / Histogram, fixed or scaled
size, placement, background, per-category legend).
https://docs.qgis.org/latest/en/docs/user_manual/working_with_vector/vector_properties.html
A user moving a project like that to RustGIS today silently loses those layers' meaning. Among
desktop GIS, RustGIS is currently the outlier without per-feature charts.
Proposed solution
Add an opt-in diagram/chart setting on vector layers: a small pie chart drawn on each
feature, driven by two or more numeric fields, in the style of ArcGIS Pro's Chart symbology and
QGIS's Diagrams. It complements the renderer rather than replacing it: a polygon keeps its fill
(e.g. a Graduated renderer underneath) while the pie on top shows composition, so both the share
and the magnitude of each feature are readable at a glance.
Where it sits in the UI: a Diagram section alongside Symbology and Labelling, both on the
ribbon's Layer tab and as a pane in layer properties, with legend entries per category. Every
action stays scriptable per the "every action is a scriptable command" goal:
layer set-diagram --kind pie --field pop_male:#4A90D9 --field pop_female:#E07B39 [--radius fixed 12 | --radius scaled 6..40]
layer clear-diagram
with undo.
Behaviour:
- Opt-in per layer; the renderer still draws the feature itself.
- Kinds: Pie first; Bar/Stacked, Histogram and Text as follow-ups.
- Categories: an ordered
(field, colour)list. Missing or non-numeric values are skipped for
that feature; a feature whose categories are all empty draws nothing. - Size: a fixed radius in points, or scaled by the categories' sum with √-area scaling
(radius ∝ √sum) clamped to a configurable min/max, mirroring howProportionalsizes work. - Placement: polygon interior point / centroid, point geometry, polyline midpoint; diagrams
take part in the label layout pass so they don't collide with labels. - Styling: start angle, background fill, stroke colour and width; sizes in points so they stay
screen-constant, like markers. - Legend: one row per category (field label + colour).
- Optional normalisation (percent of total, or divide by another field) before slicing, as
ArcGIS Pro offers. Follow-up scope; the default stays raw values. - (Follow-up) Import: read QGIS project
<DiagramSettings>(pie) and, later, ArcGIS
.lyrx/.aprxchart symbology.
Implementation sketch (from reading main, Oct 2026; happy to adjust to whatever fits
better):
- Model,
crates/map/src/symbology.rsor a newcrates/map/src/diagram.rs: a
DiagramSettings { kind: DiagramKind, categories: Vec<(field, colour)>, fixed or scaled size, start_angle, background, stroke, stroke_width }, held onLayeras
#[serde(default, skip_serializing_if = "Option::is_none")] diagram: Option<DiagramSettings>,
so old project files read unchanged and only layers that use diagrams write the new key.
Deserialisation follows the house rules: lenient reads (clamped numbers, unknown kinds read as
None) so hostile project files keep loading;clamped()constructors as in
LineMarkers::clamped; capped category counts withMAX_*constants. - Rendering,
crates/render/: a newdiagrams.rsdraws pie wedges with tiny-skia (arc paths
accumulatingvalue / total × 2πfromstart_angle) with a background disc and stroke; a
reach()for culling modelled onpoint_marks.rs; per-feature values read via
ds.field_index(...)+ds.value(row, fi).as_f64()asMarkerRotation::turndoes;
interior point / centroid from the geometry crate. - UI,
crates/ui-egui/: the Diagram pane described above. - Engine,
crates/engine/: thelayer set-diagram/layer clear-diagramcommands with undo. - Tests: slice-angle math, √-scaling + clamping, serde round-trip, lenient reads of
malformed/legacy input.
Project-format impact: one optional serialised field on Layer, a data-model change, so per
CONTRIBUTING.md this is a coordinate-first feature and this issue comes before any PR.
Default None keeps existing project files reading exactly as today.
MVP for the first PR:
- Pie kind, 2+ categories
- Fixed and sum-scaled (√) radius, clamped
- Placement: polygon interior point / centroid; point geometry
- Background, stroke, start angle
- Legend rows per category
-
layer set-diagram/layer clear-diagramcommands + undo - Tests (angles, scaling, serde round-trip, lenient reads)
- User-guide docs entry
Open questions:
- Should the setting live as a
Layerfield (as proposed; QGIS keeps Diagrams separate from
Style) or as a newRenderervariant (ArcGIS Pro makes Chart a primary symbology type)? - Should diagrams participate in label collision avoidance as obstacles, as candidates, or
both? - Naming preference: "chart" (the ArcGIS Pro term) or "diagram" (the QGIS term)?
I'd like to implement this myself (pie first, MVP scope above) once the approach is agreed.
Checked against main as of Oct 2026.
Estimated scope
Medium: a broader feature that is feasible in a reasonable timeframe
Alternatives considered
- Two overlapping layers (Graduated for one column, Proportional for the total): no per-feature
composition reading, and stacking two layers does not compose visually. - A stacked bar in the legend only: not per-feature; loses the spatial pattern the map exists to
show. - External charts (a separate plot of selected features, or the AI assistant summarising the
table): not cartographic, not on the map, not shareable as a layout. - Dot density per category: readable only in aggregate at large scales, not per feature.
None of these give per-feature composition in-map.
Activity
[-][Feature]: diagram symbology,bar and pie charts drawn on features from multiple attribute fields (ArcGIS Pro-style Chart symbology)[/-][+][Feature]: diagram symbology,bar and pie charts drawn on features from multiple attribute fields[/+]