Skip to content

Charts: a legend entry the file deletes is left out of the legend and stays deleted on save (#2359) - #2418

Draft
kiwi5boy wants to merge 2 commits into
storytold:mainfrom
kiwi5boy:legend-delete-2359
Draft

kiwi5boy wants to merge 2 commits into
storytold:mainfrom
kiwi5boy:legend-delete-2359

Conversation

@kiwi5boy

@kiwi5boy kiwi5boy commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

A chart legend entry that the file deletes is no longer drawn, and it stays deleted when the deck is saved.

Fixes #2359. Waits for storytold/craft-libs#3822 and a repin past it (see "Draft" below).

What the user saw. A line chart whose c:legend holds <c:legendEntry><c:idx val="1"/><c:delete val="1"/></c:legendEntry> drew both series in the legend.

Cause. craft-drawingml didn't read c:delete in a legend entry, and DeckCraft's LegendEntry had nowhere to keep it, so draw_legend drew every series. craft-libs#3822 adds deleted on the craft-libs side.

What changed.

  • deckcraft_model::chart::LegendEntry gets deleted: bool (serialized only when true, so existing .deckcraft JSON is unchanged).
  • chart_to and chart_from in crates/pptx/src/convert.rs carry it both ways. Filling it in as deleted: false would build after the repin, but it loses c:delete on an unedited save. The entry would go back to craft-drawingml as not deleted, which doesn't match the part as read, so the part would be rebuilt without it (tested, see Chart legend: an entry deleted with c:legendEntry/c:delete is still drawn #2359).
  • draw_legend leaves a deleted entry out. If every entry is deleted, no legend is drawn.

The approach follows the local change @valentino-saitz-optris tried while testing storytold/craft-libs#3822 (their comment), which also showed that deleted: false alone loses c:delete on save.

Tests.

  • roundtrip::a_deleted_legend_entry_survives_a_save (deckcraft-pptx): a line chart from insert.chart with the entry patched into its part reads as deleted, and c:delete is still in the part after an unedited save and after a title edit. It fails with deleted: false in both mappings (at the read check) and with deleted: false only in chart_to (at the unedited save check).
  • tests::a_deleted_legend_entry_is_not_drawn (deckcraft-render): with the second entry deleted, less is drawn in the legend than with none deleted, and something still is. It fails without the draw_legend change (428 inked pixels both ways).
  • a_legend_entry_draws_its_own_text_colour_and_size gets the new field in its struct literal.

Verification. Windows, local: cargo fmt --all --check; cargo clippy -p <crate> --all-targets -- -D warnings and cargo test -p <crate> for deckcraft-model, deckcraft-render and deckcraft-pptx, all passing; cargo xtask wasm (wasm32 check of 14 crates: ok). This issue's steps with deckcraft-cli (render, then an unedited convert): the legend shows Alpha only, and the chart part is written back byte-identical. Not run: cargo xtask ci for the whole workspace, the desktop app, PDF export, and chart types other than line.

Draft. The first commit moves every craft-libs crate, and SHARED_REV in xtask/src/pdf_deps.rs, to craft-libs#3822's head (94c3fd8b) so this branch builds. That goes against pull-requests.md rule 5 and AGENTS.md rule 10 (the rev isn't on craft-libs main yet), so it's temporary. Once #3822 merges and a repin past it lands on main, I'll drop that commit, merge main, and mark this ready. The second commit is the whole change.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@autocraft-bot autocraft-bot Bot added the bugfix Fixes something that is broken: wrong result, crash, data loss label Nov 27, 2026
…in for the repin)

Only so this draft builds; to be dropped when a repin past craft-libs#3822 lands on main.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes something that is broken: wrong result, crash, data loss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chart legend: an entry deleted with c:legendEntry/c:delete is still drawn

1 participant