Repository navigation
Conversation
|
TLDR; |
|
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 |
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.
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.
|
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:
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 |
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>
…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.
b8abcbc to
1dc6972
Compare
Summary
Enables interactive spreadsheet editing for charts using GridCraft conventions and adds full live-editing support for the first five chart types:
Changes
crates/ui-egui/src/dialogs.rs):Chart in DeckCraft — GridCraftwindow with GridCraft green header (#107C41).A (Categories),B,C,D...) and row numbers (1,2,3...), live cell editing thatupdates the chart in real time, and controls to add/remove rows and series.
⊞ Open in GridCraftbutton to export chart data to CSV and launch GridCraft.crates/engine):insert.chartnow automatically opens thechartDataspreadsheet dialog upon insertion.chartDatadialog.chart.titleandchart.gridcraftcommands, and extendedchart.datato accepttitle.crates/model,crates/render):ChartType::FIRST_FIVE,Chart::to_csv(), andChart::load_csv().data_labelsis enabled.crates/ui-egui/src/ribbon.rs,crates/ui-egui/src/panes.rs):Tests
crates/model:chart::tests::first_five_types_and_csv_roundtripcrates/render:tests::first_five_charts_render_with_data_labelscrates/engine:tests::chart_first_five_types_and_gridcraft_flow🤖 Generated with Claude Code