You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Charts: add a Pareto chart (sorted bars with cumulative percentage line) #1819
GridCraft has Histogram but no Pareto chart. Excel's Pareto subtype sorts categories by value, draws columns, and overlays a cumulative-percentage line on a secondary 0-100% axis.
Acceptance: insert.chart with type pareto shows sorted bars and the cumulative line; save/reopen keeps ChartKind::Pareto; docs no longer list Pareto as missing.
Fixes most of it. insert.chart {"type":"pareto"} makes a real Pareto chart with sorted columns and a cumulative line, it survives save and reopen, and Excel opens it as a Pareto. One rendering problem: the cumulative line is drawn against a 0–100% scale while the right-hand axis is labelled 0–120%, so the line and the labels disagree.
Setup: PR head bae3772, merged locally into main at a1c8454, Windows 11. Checked with:
the PR's tests and a temporary render probe;
gridcraft-cli from the PR and from main;
Excel for Microsoft 365 through COM, to open the PR's file.
Case
main
PR
insert.chart {"type":"pareto"} over Cause/Count (B 20, A 50, C 10, D 5, E 15)
silently becomes a clustered column chart
Pareto, columns in the order A, B, E, C, D
Save and reopen
—
still Pareto; written as a chartex part with clusteredColumn + paretoLine and a 0–1 percentage axis
The saved file in Excel
—
opens without a repair prompt; chart type 122 (Pareto), no legend, secondary axis fixed at 0 to 1
Problems:
The right-hand axis comes from nice_scale(0.0, 1.0, true), which adds headroom, so its labels run 0%–120%. The cumulative line, however, maps 0–100% onto the full plot height. In the example above:
the line ends at the "120%" label, not at "100%";
A's cumulative 50% sits on the "60%" gridline.
Excel opens the same saved file with that axis at 0–100%.
Merging: conflicts with main at a1c8454 in crates/ui-egui/src/i18n.rs (main moved the Japanese table to i18n/ja.rs) and in docs/chart-parity.md and docs/target-app-parity.md. Beyond the conflicts, merging needs:
CatAxis::Labels(&labels, &[]) in pareto(), because main's multi-level category axis gave CatAxis::Labels a second argument;
category_levels in four new ChartData literals in the chart tests;
the two Japanese strings moved into i18n/ja.rs. Otherwise i18n::ja::tests::covers_every_key_the_portuguese_catalog_translates fails.
Activity
ticket-craft commentedon Oct 18, 2026
Possibly related: #1267 and #1820.
iluebbe commentedon Oct 23, 2026
#1826 checked
Fixes most of it.
insert.chart {"type":"pareto"}makes a real Pareto chart with sorted columns and a cumulative line, it survives save and reopen, and Excel opens it as a Pareto. One rendering problem: the cumulative line is drawn against a 0–100% scale while the right-hand axis is labelled 0–120%, so the line and the labels disagree.Setup: PR head bae3772, merged locally into
mainat a1c8454, Windows 11. Checked with:gridcraft-clifrom the PR and frommain;maininsert.chart {"type":"pareto"}over Cause/Count (B 20, A 50, C 10, D 5, E 15)Pareto; written as a chartex part withclusteredColumn+paretoLineand a 0–1 percentage axisProblems:
The right-hand axis comes from
nice_scale(0.0, 1.0, true), which adds headroom, so its labels run 0%–120%. The cumulative line, however, maps 0–100% onto the full plot height. In the example above:Excel opens the same saved file with that axis at 0–100%.
gridcraft/crates/chart/src/render.rs
Line 1347 in bae3772
gridcraft/crates/chart/src/render.rs
Lines 1383 to 1384 in bae3772
Merging: conflicts with
mainat a1c8454 incrates/ui-egui/src/i18n.rs(mainmoved the Japanese table toi18n/ja.rs) and indocs/chart-parity.mdanddocs/target-app-parity.md. Beyond the conflicts, merging needs:CatAxis::Labels(&labels, &[])inpareto(), becausemain's multi-level category axis gaveCatAxis::Labelsa second argument;category_levelsin four newChartDataliterals in the chart tests;i18n/ja.rs. Otherwisei18n::ja::tests::covers_every_key_the_portuguese_catalog_translatesfails.It also overlaps with:
useandpub uselines inrender.rsandchart/src/lib.rs(trivial).chartview.rs. With Charts: resolved data and rendering are cached between frames (#1139) #1140's cache, the translated "Cumulative %" label would also need the UI language in the cache key.Tests (merged with
main, with the fixes above):cargo test -p gridcraft-chart44 passed,-p gridcraft-model23,-p gridcraft-xlsx250,-p gridcraft-engine --lib391.-p gridcraft-ui-egui --lib: 150 passed and 1 failed (the Japanese catalog test above, a merge leftover).cargo clippy -p gridcraft-chart -p gridcraft-xlsx -p gridcraft-engine -p gridcraft-model -p gridcraft-ui-egui --all-targets -- -D warningsandcargo fmt --all -- --checkare clean.