Skip to content

Charts: GridCraft spreadsheet data editor and live editing for the first 5 chart types - #195

Closed
yefan911 wants to merge 0 commit into
storytold:mainfrom
yefan911:feature/gridcraft-charts
Closed

yefan911 wants to merge 0 commit into
storytold:mainfrom
yefan911:feature/gridcraft-charts

Conversation

@yefan911

@yefan911 yefan911 commented Oct 12, 2026 •

Copy link
Copy Markdown

Summary

Enables interactive spreadsheet editing for charts using GridCraft conventions and adds full live-editing support for the first five chart types:

  1. Clustered Column
  2. Clustered Bar
  3. Line
  4. Area
  5. Pie

Changes

  • Interactive GridCraft Spreadsheet Window (crates/ui-egui/src/dialogs.rs):
    • Floating, resizable Chart in DeckCraft — GridCraft window with GridCraft green header (#107C41).
    • Live Chart Title text editor and 1-click Chart Type selector for the first 5 primary chart types.
    • Spreadsheet grid with Excel/GridCraft column headers (A (Categories), B, C, D...) and row numbers (1, 2, 3...), live cell editing that
      updates the chart in real time, and controls to add/remove rows and series.
    • ⊞ Open in GridCraft button to export chart data to CSV and launch GridCraft.
  • Engine Commands & Interactions (crates/engine):
    • insert.chart now automatically opens the chartData spreadsheet dialog upon insertion.
    • Double-clicking any chart on the canvas opens the chartData dialog.
    • Added chart.title and chart.gridcraft commands, and extended chart.data to accept title.
  • Model & Rendering (crates/model, crates/render):
    • Added ChartType::FIRST_FIVE, Chart::to_csv(), and Chart::load_csv().
    • Added data label rendering for Line and Area charts when data_labels is enabled.
  • Ribbon & Format Pane (crates/ui-egui/src/ribbon.rs, crates/ui-egui/src/panes.rs):
    • Added inline title editing and element toggles in the Chart Design ribbon tab and a new Chart Options tab in the Format Shape pane.

Tests

  • crates/model: chart::tests::first_five_types_and_csv_roundtrip
  • crates/render: tests::first_five_charts_render_with_data_labels
  • crates/engine: tests::chart_first_five_types_and_gridcraft_flow

🤖 Generated with Claude Code

@yefan911 yefan911 changed the title Charts: GridCraft spreadsheet data editor and first 5 chart types. Adds interactive GridCraft spreadsheet editing for charts (Clustered Column, Clustered Bar, Line, Area, Pie), live chart title and bar value editing, Chart Design ribbon & Format Pane controls, CSV export/GridCraft launcher, and unit/render tests Charts: GridCraft spreadsheet data editor and live editing for the first 5 chart types Oct 12, 2026
@yefan911

Copy link
Copy Markdown
Author

TLDR;
Hopefully i have to add the function for charts while also trying to enable the engine for GridCraft so we can edit the values of the charts. TBH, its a work in progress because its the first five.

@pierrevbc

Copy link
Copy Markdown
Contributor

Hi @yefan911, thanks for the chart data editor. I opened #255, which builds on this PR (it contains your commit and keeps your design: data window, title box, type picker, Open in GridCraft) and extends it to every chart type, with per-type data columns (X/Y, bubble sizes, stock prices), paste from spreadsheets, and chart formatting.

Changes it makes to the code from this PR are listed in #255 ("What this changes in #195's code"), e.g. the dialog moved to its own module, the grid read from the chart each frame (it went stale after undo), one undo step per edited cell, and insert.chart opening the editor only when asked. Happy to adjust to whatever you prefer, or to fold some of it into this PR if that's easier for review.

pierrevbc added a commit to pierrevbc/deckcraft that referenced this pull request Oct 13, 2026
The Edit Data window of storytold#195, moved to its own module and built on the
chart data commands:

- Columns follow the chart type: categories and values; X and Y values
  (shared X column, or one per series) for scatter charts; X, Y and size
  for bubble charts; stock and combo series labelled by role or type.
  Spreadsheet letters and row numbers; header row for series names.
- Live update at each key, one undo step per cell (and per title edit);
  a cell that isn't a number yet stays red and leaves the chart as it is.
  Decimal comma accepted, empty cell = gap. Enter and the arrow keys move
  down and up; typing in the last, empty row adds a point.
- A block copied from Excel or LibreOffice (tab-separated) pastes at the
  current cell and grows the table.
- Toolbar: insert, delete and move rows and series, Switch Row/Column,
  copy the table as tab-separated text, undo and redo (Ctrl+Z, Ctrl+Y in
  the window undo the chart).
- Notes for data the chart type can't show.
- The window reads the chart every frame: undo, redo and commands from
  elsewhere show at once. Large tables draw only the rows in view.
- Theme colours instead of fixed ones; the GridCraft banner, title field,
  type selector and Open in GridCraft button of storytold#195 are kept.
pierrevbc added a commit to pierrevbc/deckcraft that referenced this pull request Oct 13, 2026
The Edit Data window of storytold#195, moved to its own module and built on the
chart data commands:

- Columns follow the chart type: categories and values; X and Y values
  (shared X column, or one per series) for scatter charts; X, Y and size
  for bubble charts; stock and combo series labelled by role or type.
  Spreadsheet letters and row numbers; header row for series names.
- Live update at each key, one undo step per cell (and per title edit);
  a cell that isn't a number yet stays red and leaves the chart as it is.
  Decimal comma accepted, empty cell = gap. Enter and the arrow keys move
  down and up; typing in the last, empty row adds a point.
- A block copied from Excel or LibreOffice (tab-separated) pastes at the
  current cell and grows the table.
- Toolbar: insert, delete and move rows and series, Switch Row/Column,
  copy the table as tab-separated text, undo and redo (Ctrl+Z, Ctrl+Y in
  the window undo the chart).
- Notes for data the chart type can't show.
- The window reads the chart every frame: undo, redo and commands from
  elsewhere show at once. Large tables draw only the rows in view.
- Theme colours instead of fixed ones; the GridCraft banner, title field,
  type selector and Open in GridCraft button of storytold#195 are kept.
@echelon

echelon commented Oct 14, 2026

Copy link
Copy Markdown
Member

Thank you for the work here, @yefan911 — a GridCraft data editor for charts is something we'd like. We can't merge this version, though, for these reasons:

  • Running programs from the engine. chart.gridcraft is an engine command, so MCP and the control channel can call it. It writes a CSV to any caller-given path and then runs cargo run --manifest-path C:\Users\parra\gridcraft\Cargo.toml (or a gridcraft found on PATH). DeckCraft must never build or launch programs from a personal path or PATH on behalf of an automation client, and the engine layer can't spawn processes at all (it has to build for wasm; see AGENTS.md §4).
  • CLAUDE.md is rewritten to point agents at a personal fork. Please leave CLAUDE.md/AGENTS.md out of feature PRs.
  • Locked crates are downgraded (chrono 0.4.45 → 0.4.39, getrandom).

An acceptable shape would keep chart data editing inside DeckCraft (or hand data to another app only through an explicit, user-initiated UI action with no paths taken from command params), without the CLAUDE.md and Cargo.lock changes. We'd be glad to review that.

If you haven't already, come join us on Discord: https://discord.gg/artcraft

pierrevbc added a commit to pierrevbc/deckcraft that referenced this pull request Oct 15, 2026
The chart data as a data sheet shows it, the commands that edit it, and
the Edit Data window. The window, live title editing and type picker
build on yefan911's storytold#195, re-expressed here without its CSV export and
external spreadsheet launcher: the data stays inside DeckCraft.

Model (chart_data):
- One row per point, series names on the header row, and the columns
  each chart type needs: categories and one value column per series;
  scatter X values (shared, or one column per series) then Y values;
  bubble sizes; stock series labelled by role (volume, open, high, low,
  close); combo series by their own type.
- Cells set from text (decimal comma, thousands separators, percent; an
  empty cell is a gap; a row past the last point adds one). Points and
  series inserted, removed and moved, point fills following their
  points; rows and columns switched; tab-separated blocks pasted at a
  cell (the table grows) and copied back. Notes for data a type can't
  show.

Commands (Chart Design > Data), for the editor, the control channel
and MCP alike:
- chart.grid (query), chart.setCell, chart.paste, chart.insertRows /
  deleteRows / moveRow, chart.insertSeries / deleteSeries / moveSeries,
  chart.switchRowColumn, chart.title.
- chart.data and insert.chart take X values and bubble sizes per series
  (or xValues for all), stock series by role, numbers as numeric text,
  and null for a gap. A data command that changes nothing leaves no
  undo step; commands carrying the same undoGroup in a row make one
  undo step, so typing in a cell updates the chart at each key and
  undoes at once.
- insert.chart opens the data editor only when asked (editData, which
  the ribbon passes); double-clicking a chart opens it. Programmatic
  calls never open dialogs.

Edit Data window (ui-egui chartdata):
- Spreadsheet letters and row numbers, columns following the chart
  type, live update at each key, a cell that isn't a number yet stays
  red; Enter and the arrow keys move; paste from Excel or LibreOffice;
  toolbar to insert, delete and move rows and series, switch row and
  column, copy, undo and redo. Chart title field and a Type menu with
  the chart gallery. It reads the chart every frame, so undo and other
  commands show at once; large tables draw only the rows in view.

Co-authored-by: yefan911 <nodmcaplsmilo@gmail.com>
pierrevbc added a commit to pierrevbc/deckcraft that referenced this pull request Oct 15, 2026
…in's chart fields

Format pane and ribbon:
- The Format pane's Chart Options picks a chart element (chart and plot
  area, title, legend, axes, axis titles, gridlines, data labels, each
  series) and shows its options: fill, border, font, legend position,
  axis bounds, units, log scale, reverse order, crossing, tick marks,
  label position and rotation, number format, gridlines, label parts and
  positions, gap width, overlap, pie angle and explosion, hole size,
  markers, smoothing and point colours. Its chart area page keeps storytold#195's
  basics: title, type (the chart gallery), elements, Edit Data.
- Chart Design gains Add Chart Element, Quick Layout, Change Colors and
  Chart Styles; the new Chart Format tab holds the element picker,
  Format Selection, Reset to Match Style, and the element's fill,
  outline and text.
- Scatter and bubble charts get X axis bounds.

Formatting follows the chart type and variant: a marker on a type
without markers turns it into its variant with markers (the series'
own type in a combo); a pie or doughnut explosion is the exploded
type's; point explosions follow points inserted, removed and moved;
styles and layouts know every pie type and combo lines.

Main's chart fields hold what both have, with no second copy in
ChartFormat: the legend overlay, each series' type and axis in a combo,
the value axes' bounds, major unit, number format, visibility, log base
and minor gridlines (Chart::y_*, y2_*, y_log_base, minor_gridlines), a
category axis' direction (Chart::cat_reversed), the chart and title
text sizes, and number formats through main's numfmt (which now rounds
halves away from zero, as spreadsheets do). chart.format.axis and the
pane set them; the reader and writer read and write them where main
does.
@yefan911 yefan911 closed this Oct 16, 2026
@yefan911
yefan911 force-pushed the feature/gridcraft-charts branch from b8abcbc to 1dc6972 Compare October 16, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants