Repository navigation
Charts: multi-level category axes (year beside month) read, drawn and written back - #1088
Merged
Merged
Conversation
A category range two or more columns wide beside a column of values (year beside month, Excel's multiLvlStrRef) was read as one flat list: 36 rows in two columns became 72 categories, the series sat in the left half of the plot and the years and months shared one row of labels. Saving wrote the range as a plain strRef, so Excel lost the two-level axis too. - gridcraft_core::category_levels: the shape of a category range beside its values (levels are columns when the points run down the rows, rows when they run along the columns; up to three outer levels), shared by the chart and xlsx crates. - ChartData.category_levels: the outer levels, nearest the labels first, one entry per category, non-empty where a group starts. resolve fills it; a single column is unchanged. - render: the outer levels in rows under the labels, a group's name centred under its categories with a separator at each boundary; in bar charts in columns beside the labels. - xlsx: <c:cat> written as multiLvlStrRef with the level caches (innermost first), so the axis survives a round trip. Tests in core (shapes), chart (resolve and layout for columns, bars and a row of values) and xlsx (written XML, read-back, stability, a single column stays strRef). chart-parity, gaps § 4 and the ROADMAP progress log updated. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 13, 2026
Merged
This was referenced Oct 16, 2026
aiongg
added a commit
to aiongg/gridcraft
that referenced
this pull request
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A category range two or more columns wide beside a column of values (year beside month, what Excel saves as
multiLvlStrRef) was read as one flat list: a 36-row, 2-column range became 72 categories, so the series were squeezed into the left half of the plot with the years and months mixed on one row. Saving wrote the range back as a plainstrRefwith the flattened cache, so the two-level axis was lost for Excel too. This is the "multi-level categories" item ofdocs/chart-parity.md§ Work.What changes
gridcraft_core::category_levels: the shape of a category range beside its values (levels are the columns when the points run down the rows, the rows when they run along the columns; the innermost level is the column or row nearest the values, up to three outer levels are kept). Shared by the chart and xlsx crates.ChartData.category_levels(serde default): the outer levels, nearest the labels first, one entry per category, non-empty where a group starts, as the cells are.resolvefills it from the range; a plain column is unchanged.<c:cat>is written asmultiLvlStrRefwithmultiLvlStrCache(innermost level first, outer levels with only the cells that start a group), so the axis survives a round trip; reading already kept the reference.Tests
category_level_tests(core): wide and tall ranges, the cap, whole columns, literal values.two_level_categories_resolve_and_draw(chart): six evenly spaced labels across the plot instead of twelve slots, the years in a row below them under their own groups, the column-beside-labels layout for bars, a row of values, and a plain column staying flat.multilevel_category_roundtrip(xlsx): the written XML, level caches, a row-of-values layout, read-back of the reference, stability across saves, and a single column stayingstrRef.cargo test -p gridcraft-core -p gridcraft-chart -p gridcraft-xlsx,cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --check.docs/chart-parity.md,docs/gaps.md§ 4 and theROADMAP.mdprogress log updated.🤖 Generated with Claude Code