Skip to content

UI: chart-type menus show a sample of each chart (#353) - #487

Open
NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:chart-gallery-previews
Open

NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:chart-gallery-previews

Conversation

@NikitkaRa

Copy link
Copy Markdown
Contributor

Summary

  • New crates/ui-egui/src/chartgallery.rs: a small sample chart for every ChartType, drawn in code with our own shapes and colours (no vendor artwork, per AGENTS.md §1). Each sample is a list of unit-space primitives (bars, lines, areas, wedges, dots), so it is easy to test.
  • Insert ▸ Chart and Chart Design ▸ Change Chart Type show the main types as a grid of tiles, sample above and name below, instead of plain text buttons.
  • Change Chart Type marks the selected chart's current type. Picking a type closes the menu.

Test plan

  • cargo test -p deckcraft-ui-egui --lib chartgallery: every chart type has a non-empty sample inside its box with finite coordinates, and no two main types share a sample
  • cargo xtask ci (fmt, clippy, test, assets, layers, wasm)
  • Look at both menus in the running app (I couldn't screenshot it on my build machine: winit there lacks libxkbcommon-x11)

Closes #353

anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
* Give dialogs roomier text fields and padding

Single-line fields in dialogs and side panels were only as tall as one line of text, and modals used the popup frame's tight margin. Fields are now 30 points with more inset, and every modal shares one padded card so titles and buttons sit clear of the edge.

* Keep long labels inside their rows and dialogs

Painted names ran past the edge of fixed rows, and a page hover tip was drawn above open dialogs. Labels now end in an ellipsis, tab rows wrap, and those tips stay hidden while a dialog is open.

---------

Co-authored-by: Brandon Thomas <echelon@gmail.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
… per-page invalidation (storytold#1122)

* Content edits on heavy documents: narrow refresh, cached appearances, per-page invalidation

Every content edit (drag, resize, retype) on a large document ran a full
synchronous refresh on the UI thread: a whole-file re-inspection plus a
redraw of every missing annotation appearance, then dropped all page
rasters. On a 72 MB / 202-page CAD file with 27k appearance-less
annotations each commit cost ~1.5 s before anything re-rendered. Now ~0.3 s.

- New Scope::Content for edits that touch only page content, resources and
  added content/marks (move/resize/retype/images/added items/marks): the
  page tree, annotations, fields, links, outline and fonts are unchanged,
  so refresh_content rebuilds working bytes, display bytes and renderer and
  validates with a light check_pages (parse plus page count, keeping the
  roll-back guarantee) instead of a full inspect. added/marks are re-read
  only when the edit can change them; undo/redo re-read both.
- AppearanceCache in pdfcraft-annot: built display appearances are reused
  while no annotation edit runs (content edits leave every annotation
  dictionary alone); cleared on comment, structural and full refreshes.
  set_appearance is split into build/apply halves so a hit skips the draw.
- check_pages in pdfcraft-render: light post-edit validation.
- Viewer: single-page content edits invalidate only their page
  (page_changed); other pages keep tiles, text and thumbnails.
- XFA dataset sync now also runs for content edits.

Co-Authored-By: Muse Spark <noreply@meta.com>

* Fonts added by a content edit show in Properties and doc_info (read again on demand); form edits clear cached appearances too

* M14: DATE_LANGUAGES is a static (21 entries trip clippy's large_const_arrays); rustfmt the Greek entry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Preferences scroll in a short window; tests scroll to controls below the fold (storytold#487's roomier rows); the highlighter test waits for its mark under load

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Select tool: a multi-click selects only on the frame egui reports it, so a cleared selection (or the highlighter's marked word) isn't selected again

The highlighter test now clicks at a human pace, with frames in between, which is what exposed it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Muse Spark <noreply@meta.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Insert > Chart and Chart Design > Change Chart Type listed chart types as
plain text buttons, with no picture of what each type looks like.

A new chartgallery module draws a small sample chart per type in code (our
own shapes and colours, no vendor artwork) and lays the types out as a grid
of tiles, sample above and name below. Both menus use it; Change Chart Type
marks the selected chart's current type, and a pick closes the menu.

Co-authored-by: Cursor <cursoragent@cursor.com>

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: chart-type menus show a sample of each chart (#353). The picker (Insert ▸ Chart and Chart Design ▸ Change Chart Type) shows a tile per type with a small sample chart "drawn in code (our own shapes and colours)", defined as elements in unit coordinates with a series colour. Drawing the samples from the project's own shapes avoids any image asset or Microsoft artwork, which is the right answer to the provenance question; PowerPoint's own chart icons are Microsoft's art and must not be copied, and the samples here are generic. A tile per type is many small drawings per frame, which are cheap. Colour must not be the only difference between samples for accessibility. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

@aiongg aiongg added the missing feature The reference application has it and we do not, or only part of it label Nov 4, 2026

@aiongg aiongg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated review (Opus). Not a maintainer decision.

Small fixes needed (not certain):

Adds a grid of code-drawn sample tiles for the main chart types to Insert ▸ Chart and Change Chart Type, marks the chart's current type and closes the menu on a pick. The samples use only generic shapes and colours, and no assets are added.

  • egui fills a closed path correctly only when it is convex. The doughnut and sunburst ring wedges (crates/ui-egui/src/chartgallery.rs:80, outer arc plus reversed inner arc) are concave, so part of the hole gets filled. Emitting one quad per arc step keeps each piece convex.
  • The area and surface samples (crates/ui-egui/src/chartgallery.rs:115 and :205) are one polygon under a polyline with a dip, which is also concave. One trapezoid per segment down to the baseline draws them correctly.
  • The comment at crates/ui-egui/src/chartgallery.rs:231 says the samples are convex enough, which is not true for the doughnut and area samples.
  • crates/ui-egui/src/ribbon.rs:3047 marks the type of the first chart anywhere in the selection, but chart.type is sent to the first selected shape (ribbon.rs:3059). Reading the current type from that same shape keeps the marker and the action in step.
  • The named list after the tiles (ribbon.rs:1239, :3052) uses skip_while(Option::is_some).flatten() on chart_menu_types, which correctly leaves just the newer chart types (sunburst, Pareto, box and whisker) that are not already shown as tiles.
  • Both menus now run the command once after the loop and call ui.close() (ribbon.rs:1244-1247, :3057-3063), so tiles and named buttons share one path.
  • The menus have not been checked in the running app yet. A screenshot of both menus would confirm tile size, labels and the selected-tile highlight.

Claims checked:

  • verified: Every ChartType gets a small sample chart drawn in code with the project's own shapes and colours, with no vendor artwork. (crates/ui-egui/src/chartgallery.rs:96 sample() matches every ChartType variant and returns unit-space primitives; colours come from SERIES_COLOURS at chartgallery.rs:30; no as…
  • contradicted: The samples draw as the chart they stand for (unit-space bars, lines, areas, wedges, dots painted into the tile). (crates/ui-egui/src/chartgallery.rs:80 builds each doughnut wedge as one concave polygon (outer arc plus reversed inner arc), and chartgallery.rs:115 builds each area as one concave pol…
  • verified: Insert ▸ Chart and Chart Design ▸ Change Chart Type show the main types as a grid of tiles, sample above and name below, instead of plain text buttons. (crates/ui-egui/src/ribbon.rs:1236 and ribbon.rs:3049 call chartgallery::picker with ChartType::MAIN; chartgallery.rs:249 picker lays out 4 tiles p…
  • verified: Change Chart Type marks the selected chart's current type. (crates/ui-egui/src/ribbon.rs:3044-3047 reads the chart kind from the selection and passes it as selected; chartgallery.rs picker fills the tile with t.selected and draws an accent outline. It takes the first chart in the selection, while…
  • verified: Picking a type closes the menu. (crates/ui-egui/src/ribbon.rs:1244-1247 and ribbon.rs:3057-3063 run the command and call ui.close() when a tile or named button is picked.)
  • verified: Closes #353 (chart samples missing from the chart-type drop-down). (crates/ui-egui/src/ribbon.rs:1236 and ribbon.rs:3049 now show sample tiles in both chart-type drop-downs; these are the only two chart-type menus (crates/ui-egui/src/menus.rs:238 only runs insert.chart without a type).)

Recommendation: merge after the fixes above; they may be pushed to this branch.

Reviewed at ebacf5b.

@aiongg

aiongg commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Automated message. Not a maintainer decision.

This branch conflicts with main. Could you merge or rebase main into it? The conflict needs a person to resolve.

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

missing feature The reference application has it and we do not, or only part of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chart picture samples missing

3 participants