Files
gridcraft/docs/chart-parity.md
T
Pranav f6a0556b9e Objects: one selection for every floating object, eight resize handles, and objects that follow edits (#470)
* Objects: one selection for charts, pictures, shapes and slicers, with eight resize handles

The sheet tracked the selected object as a bare id in `selected_chart`, so
only charts and text boxes drew a selection frame, only the bottom-right
corner resized, and the kind of the selected object had to be guessed from
the id. The selection is now `SheetApp::selected_object: Option<ObjRef>`,
with `selected_chart()` kept for the Chart Design tab and the Format Chart
pane.

- Model: `ObjKind` (chart, image, shape, slicer) and `ObjRef { kind, id }`;
  `Sheet` helpers find, move and remove an object by `ObjRef` and walk every
  object's anchor in a fixed order. `next_object_id` saturates instead of
  overflowing on an id at `u32::MAX` read from a file.
- Commands: `object.delete`, `object.move` and `object.setAnchorMode` accept
  the four kinds through one parameter check, refuse an unknown kind or id
  instead of succeeding silently, and clamp hostile offsets. `object.delete`
  replies with the deleted object. Arrange and the Selection Pane include
  slicers, which stack above the other objects.
- Sheet: the selected object of any kind draws a frame with eight handles
  over every object. Each handle resizes only its own edges, which never
  cross; the body moves the object, and the first drag frame already applies
  the pointer's movement. The pointer shows the handle's resize cursor or a
  move cursor, with the diagonals swapped on a right-to-left sheet, where the
  frame moves with its object.
- Keys: Escape drops the object selection; Delete and Backspace keep
  deleting the selected object (#213). A selection whose object disappears
  (undo, redo, delete, sheet switch) is cleared.
- Double-click: `open_object` routes by kind (a text box edits in place, a
  chart opens Format Chart).
- Control protocol: `ui.inspect` reports `selectedObject {kind, id}` and
  keeps `selectedChart`; `ui.object.select` selects any object and replies
  with its rect. The snapshot example takes `--object <id>`.

Tests: engine tests for every kind by kind and id, the Selection Pane and
hostile parameters; UI tests for selecting each kind (a slicer over a chart
takes the click), all eight handles on four kinds, cursors, Delete,
Backspace and Escape, undo and redo, double-click routing, and resizing on a
right-to-left sheet. Existing tests use the new selection API.

* Objects: every kind follows edits; chart series follow cut-moves and sheet deletes

Structural edits and sorts kept three hand-indexed lists (charts, images,
shapes) in step in two places, and slicers were left out of both, so a
slicer stayed put when rows were inserted above it. Chart series were
rewritten for inserted and deleted lines and for sheet renames, but not for
cut-moves or sheet deletes, which left them pointing at the old cells.

- Inserting and deleting rows and columns and sorting walk
  `Sheet::object_anchors` and `object_anchors_mut`, one fixed order over
  every kind, so slicers now follow their cells by their anchor mode like
  the other objects, and a new kind cannot be forgotten in one of the
  passes.
- `rewrite_cell_links` is the one place that rewrites the references
  floating objects hold (chart series values, categories and names,
  and the source block a chart was made from).
  `rewrite_all_formulas` calls it, which covers inserting and deleting
  lines and cells and cut-moves on one sheet or across sheets; renaming and
  deleting a sheet call it too, so a series into a deleted sheet becomes
  #REF!, as a formula does.
- Copying a sheet gives its charts, pictures, shapes and slicers fresh ids,
  keeping ids unique across the workbook, which object selection and the
  `{kind, id}` commands rely on.

Tests: every kind through row and column inserts and deletes, an absolute
shape, a sort and undo; a slicer through inserted rows; chart series
through a cut-move, a sheet rename, a sheet delete and undo; ids after a
sheet copy.

* Objects: bubble sizes follow edits like the other series references

`rewrite_cell_links` rewrote a chart series' values, categories and name
but not its bubble sizes, so inserting or deleting lines, a cut-move or a
sheet rename left a bubble chart's sizes pointing at the old cells. They
are now rewritten with the rest.

Test: bubble sizes through an inserted row, a cut-move and a sheet rename.

* Objects: a resize handle under the headers leaves the press to them

A selected object's handles reach a few points outside it, and a press
was matched against them before any check of where it landed, so a press
on the column or row header beside an object at the sheet's edge resized
the object instead of selecting the column or row. The cursor already
ignored handles outside the cells.

`chartview::selected_handle` finds the selected object's handle under a
point only over the cell area, as `hit` does, and not while objects are
hidden; the press and the cursor both use it.

Test: presses within a handle's reach over the column header and the row
header neither move nor resize the object.

* Objects: each drag of an object is its own undo step

A drag merges its frames into one undo step by dropping a new step whose
label matches the one before it. Its first frame did the same, so a second
drag of an object (a move after a move, or a resize after a move) merged
into the first drag's "Move Object" step, and one undo took back both.

`Drag::Object` records whether the drag has made its step; only the later
frames of the same drag merge into it.

Test: a move and then a resize of a picture take two undos to reverse,
the first restoring the moved picture.

* Objects: the parity and gap docs no longer list chart resizing as missing

gaps.md (§4), target-app-parity.md (the Essentials tier's work, the
Mainstream chart row, the interaction discount and the Essentials chart
task) and chart-parity.md (the element table and the work list) still
described charts as impossible to resize (#190). Charts move and resize
from eight handles like every floating object, so those statements now
say so; the 2026-10-10 revision rows and the 10-10 re-check stay as
history. Scores and the 40-60 h chart estimate are unchanged (resizing
was 1-2 h, within the rounding).

* Objects: one chart evidence paragraph in gaps.md; trendlines are not missing

gaps.md §4 carried two evidence paragraphs, an older one saying PRs #158
and #161 were open and a newer one saying all 2-D kinds survive XLSX round
trip, both repeating the resize, smooth-line, Switch Row/Column and
trendline statements. It is one paragraph with the current status again.

The Mainstream chart row in target-app-parity.md listed trendlines as
missing; they are read, written and drawn (`Series::trendlines`, the XLSX
chart reader and writer, `chart.addElement`), as chart-parity.md records.
The row now says so and keeps "no axis options". No score change.

* Objects: only the selected object's handles resize; a press elsewhere on an object moves it

A primary drag looked for a handle under the press on whatever object it
grabbed, so pressing near the edge or corner of an object that was not
selected started a resize, while the pointer over that spot showed the
Move cursor (handles are only shown, and only offered by the cursor, on
the selected object). The press now takes its handle from
`chartview::selected_handle`, the same lookup the cursor uses; a press on
any other object selects and moves it.

Test: dragging an unselected shape by its bottom-right corner shows the
Move cursor, then selects and moves the shape without resizing it.

* Docs: ui.object.select says what it replies when it clears the selection

* Objects: a test pins that both anchor accessors visit the same objects in the same order

Sorting and row or column edits read every anchor through
`object_anchors`, compute the new ones and write them back through
`object_anchors_mut` in step. Nothing checked that the two accessors
visit the same objects in the same order; a kind of floating object
reaching only one of them would have paired objects with other objects'
anchors silently.

Test: two objects of every kind are inserted in a mixed order, each
anchor is marked with its position through the mutable accessor, the
marks are read back through the shared one in the same sequence, the
count matches the per-kind collections, and the mark is found on the
object `object_anchor` names by kind and id. The test's constructor
matches on `ObjKind` exhaustively, so a new kind does not compile until
the test covers it.

* Objects: sorting keeps the size of a "move and size" picture whose lines swap places

A picture anchored to move and size with cells and spanning two rows
(or columns) was re-fitted between its top-left and bottom-right lines
after a sort. When the sort put the bottom line above the top one, the
fitted extent was negative and the picture collapsed to a zero height
or width. It now keeps its old size on that axis and travels with its
top-left line, like a "move only" picture.

Tests: for a sort by rows and one by columns, "move and size" and
"move only" pictures inside one line travel with it (the first
re-fitted to the same line, the second at its own size), an absolute
picture stays while the cells move under it, a two-line picture whose
lines swap keeps its size, and undo restores every anchor.

* Objects: a copied sheet's objects get free ids even when a file used the largest id

`Workbook::next_object_id` returned one more than the largest id in use,
saturating at `u32::MAX`. A workbook read from a file can carry an object
with that id; every later insert (a chart, picture, shape, table or
slicer) then got `u32::MAX` again, and so did each object of a copied
sheet, whose ids also came from a saturating counter. Lookups and
selection take the first object with an id, and `object.delete` removes
every one.

`Workbook::free_object_ids(count)` now returns distinct unused ids: those
above the largest in use while they last, then the lowest free ones from
1. `next_object_id` takes the first of them, and the sheet copy takes one
per copied object (and refuses if the id space were ever exhausted). The
model test that recorded the saturation now checks the free ids instead,
and a new one covers a file that used the largest ids: the free ids come
from below, 100,000 of them distinct and in order.

Test: object_ids_stay_unique_when_a_file_used_the_largest_id gives a
shape id u32::MAX, inserts two shapes and copies the sheet; every shape id
is distinct across both sheets. It fails without the fix (both new shapes
get 4294967295).

* Objects: main's chart data table compiles with the object selection and the model's object test

Two leftovers of the merge of origin/main (25881a8e), neither a textual
conflict: `Chart` gained a `data_table` field, which the `push_object`
helper of the model's object test did not set (it is `None`, as in
`insert.chart`); and chart_data_table.rs set the `selected_chart` field
this branch replaced by `selected_object`. The test selects its chart as
a floating object, as the branch's other tests do.

* Objects: object.move and chart.set keep a size a file made larger than 10,000

`object.move` clamped `width` and `height` to 10,000 points, the most it
gives a new size, while the XLSX reader accepts anchors far past that.
A resize of a picture a file made 12,000 wide passed 11,990 through the
clamp and jumped to 10,000; `chart.set`, whose Format Chart pane sends
the unchanged dimension back with the edited one, clamped the same way.

Each dimension is now capped at 10,000 or the object's current size,
whichever is larger (`size_cap`): such an object keeps its size when it
is moved, shrinks by what a resize asks and never grows further, and a
hostile size is still capped. The params doc of `object.move` and the
control protocol notes say so.

Tests: an_oversized_imported_object_keeps_its_size_when_moved_and_shrinks_only_by_a_resize
makes a picture 12,000 by 300, writes and reads it back as a file, then
moves it without a size (12,000 stays), asks 12,010 (stays 12,000),
11,990 (11,990, no jump) and 50,000 by 50,000 (11,990 by 10,000).
chart_set_keeps_a_chart_size_a_file_made_larger_than_the_limit does the
same through `chart.set`. Both fail without the fix (width 10,000).

* Objects: dragging an object's body sends its position only, not its size

`drag_object` sent `width` and `height` with every step of a body drag,
so moving a picture a file made 12,000 wide shrank it to the 10,000 that
`object.move` gives a new size. Only a handle drag sends a size now; a
body move leaves the engine's size alone.

Tests (real input): dragging_the_body_of_an_oversized_imported_object_keeps_its_size
reopens the workbook with a 12,000 by 60 picture, drags its body by
30 by 25 and checks the size is untouched, the picture moved with the
pointer and the journaled `object.move` carries no width or height; it
fails without the fix (the journaled command carries both, and without
the engine's cap the picture is 10,000 wide).
a_handle_drag_on_an_oversized_imported_object_resizes_by_the_drag_only
moves the left handle 10 px right: the picture is 10 points narrower in
the window and keeps a width near 12,000, with no jump to the limit.

* Objects: the Format Chart Size fields show a chart's real size and send only the edited dimension

The Width and Height fields ranged 40 to 4,000 and sent both values on
every edit. egui clamps an existing value into a field's range, so a
chart a file made 12,000 wide showed "Width 4000", and typing a new
height sent that 4,000 as the width: the chart shrank although only its
height changed, and the cap `chart.set` keeps for an existing size
cannot help once the pane itself sends 4,000. Each field's range now
reaches the larger of 4,000 and the chart's current size, so the field
shows the real size, and a commit sends only the dimension that differs
from the chart's (`chart.set` reads `width` and `height` independently).

Test (real input): the_size_fields_keep_an_oversized_imported_chart_width_when_the_height_changes
reopens a workbook with a 12,000-wide chart, opens Format Chart Area's
Size section, checks the Width field shows 12000 and types 201 as the
height: the width stays 12,000, the height is 201 and the journaled
chart.set carries no width. Without the fix the field shows
"Width 4000".
2026-11-02 09:30:13 +01:00

11 KiB
Raw Blame History

Chart parity

Last reviewed: 2026-10-18 · Last updated: 2026-11-02 · Change: minor (charts resize from eight handles; earlier: chart data tables, legend keys and borders, native XLSX round-trip and print/PDF; earlier: selected chart source outlines stay beneath floating objects) · Target: Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4

Excel's chart types and chart elements against GridCraft. Part of target-app-parity.md. Breadth ~50%, ready ~30%, 40–60 h (estimated).

Sources: crates/model/src/features.rs (ChartKind, Chart, Series), crates/chart/src (layout and rendering), crates/xlsx/src/chart.rs (DrawingML chart parts), merged PRs #62, #116, #158 and #161, and issue #190.

Chart types

Excel type Excel subtypes GridCraft Notes
Column clustered, stacked, 100% stacked, 3-D clustered/stacked/100%, 3-D column 3 of 7 no 3-D
Bar clustered, stacked, 100%, 3-D ×3 3 of 6 no 3-D
Line line, stacked, 100% stacked, with markers ×3, 3-D line 3 of 7 (line, with markers, stacked) no 100% stacked; smoothed lines landed (#62)
Pie pie, 3-D pie, pie of pie, bar of pie, doughnut 2 of 5 (pie, doughnut) no exploded, pie of pie, bar of pie
Area area, stacked, 100%, 3-D ×3 3 of 6 no 3-D; 100% stacked drawn as shares of each category's total and kept as percentStacked in XLSX
X Y (scatter) markers, smooth lines (±markers), straight lines (±markers) 2 of 5 no smooth lines
Bubble bubble, 3-D bubble 1 of 2
Stock high-low-close, open-high-low-close, volume-HLC, volume-OHLC 1 kind
Surface 3-D surface, wireframe, contour, wireframe contour 0 of 4
Radar radar, with markers, filled 1 of 3
Treemap, Sunburst 1 each 2 of 2
Histogram, Pareto 2 1 of 2 no Pareto
Box & Whisker 1 1 of 1 exclusive (default) and inclusive quartiles per series; XLSX round-trip; chart.set {quartiles} changes all series
Waterfall, Funnel 2 2 of 2 lose their kind in XLSX (PR #161)
Box & Whisker 1 1 of 1
Waterfall, Funnel 2 2 of 2
Filled map 1 0 needs geographic boundary data (licensing decision)
Combo custom combinations, secondary axis yes (line on secondary axis)
Total ~60 subtypes 26 (~43%) usage-weighted breadth higher (~65%): column, bar, line, pie and scatter dominate

Chart elements and formatting

Element Excel GridCraft
Move and resize the chart object yes yes (eight handles, each moving only its own edges; Format Chart Area Size fields) (#190)
Selected chart source-data outline visible on uncovered cells, beneath floating objects painted above cells and below charts, shapes, pictures and slicers; retains pane clipping and right-to-left cell geometry (#2861)
Chart title, axis titles text, linked to cells, full formatting text only
Legend position, overlay, formatting, per-entry delete position only
Data labels value, category, series, percentage, from cells, callouts, position one on/off flag
Gridlines major/minor per axis, formatting one on/off flag
Axis options min/max/units, log scale, reverse order, crossing point, display units, date axis, number format missing (auto only)
Multi-level category axis (a category range two or more columns wide beside the values: year beside month) the outer levels grouped under the labels with separators read (multiLvlStrRef), drawn (rows under the labels; columns beside them in bar charts; up to three outer levels), written back with Excel's level caches
Secondary axis any series line series in combo charts
Trendlines linear, exponential, logarithmic, polynomial, power, moving average, equation and R² all six types, several per series, name, forward/backward forecast, set intercept, equation and R² label, line colour/width/dash; read, written and drawn on 2-D column, bar, line, area, scatter and bubble series; chart.addElement trendline adds/removes them. No Format Trendline pane, label position/number format not kept
Error bars fixed, %, standard deviation/error, custom missing
Up/down bars, high-low lines, drop lines, series lines yes missing
Data table under the chart yes yes for column, bar, line, area and compatible combo charts: live formatted values, blank cells, grouped category headers, optional legend keys, horizontal/vertical borders and outline; native c:dTable XLSX round-trip; shared UI/print/PDF rendering
Per-series / per-point fill, line, marker, effects Format pane for every element series colour only; Format Chart pane covers chart-level options
Chart styles and colour palettes ~16 styles × colour sets style number stored, own palettes
Chart sheets yes kept, not editable: not shown, and written back unchanged in their place on save (#727); left out when a sheet they plot is deleted or renamed. No F11 / Move Chart > New sheet
Chart templates (.crtx) yes missing
Recommended Charts yes dialog with recommendations from the data's shape (own heuristic) and an All Charts list, live previews (#215)
Switch Row/Column, Select Data yes yes (Switch on charts read from files landed in #116)
Recommended Charts yes partial (Insert ▸ Recommended)
Switch Row/Column, Select Data yes yes (Switch on charts read from files landed in #116); Select Data dialog: data range, remove series, Horizontal (Category) Axis Labels (#287). No series add/edit or hidden/empty cell options
Sparklines (line, column, win/loss, markers, axis) yes line, column, win/loss
PivotCharts yes Insert ▸ PivotChart (insert.pivotChart): bound to a PivotTable's report, rebuilt on refresh and layout changes, c:pivotSource round trip; no field buttons, innermost category level only
Animation on data change yes (Windows) no

Data tables are controlled by chart.addElement {element: "dataTable", on: true, dataTableKeys: true} or chart.set {dataTable: true}. chart.set also accepts dataTableKeys, dataTableHorizontalBorder, dataTableVerticalBorder and dataTableOutline. Changing to an unsupported chart kind removes the table (Undo restores it). The chart legend is independent. Bar charts keep their vertical category axis; other supported charts use the table headers instead of repeating category-axis labels. Individual labels and values that exceed a cell's width are shortened with an ellipsis. Tables are bounded to 128 categories, 32 series and half the available chart height; if they cannot fit, a “Data table needs more space” notice replaces the table. Enlarge the chart or reduce its source range. Table-specific font/fill styling and exact Excel layout fidelity are not implemented; Excel-side verification has not been performed.

Format reference: Microsoft's DrawingML data table documentation.

XLSX round-trip

Charts are read from and written to DrawingML chart parts, but only the fields the model holds survive: anything else (axis scaling, label options, error bars, per-point formats, chartex extensions) is lost when GridCraft saves a workbook it opened. That is the main reason charts are ~30% ready: a user who opens an Excel workbook with charts and saves it gets simpler charts back.

Series data, categories and names may refer to defined names, as dynamic (OFFSET) ranges do: Excel writes a workbook-scoped name as [0]!Name in <c:f>. GridCraft reads it as the bare name and writes it back with [0]!; a sheet-scoped name is written Sheet!Name. Excel needs the qualifier: with a bare name in <c:f> it draws the whole chart blank, without a repair prompt (observed in Excel for Windows, Microsoft 365). External books ([1]Sheet1!…) are kept as they are (#1686). Such series get no numCache/strCache on save (#1690).

Work (40–60 h)

  1. Preserve unmodelled chart XML on round-trip (keep the original part, patch only edited fields): 6–10 h.
  2. Axis options, label options, gridlines per axis, legend formatting: 10–15 h.
  3. Error bars; Format Trendline pane (trendlines landed): 4–6 h.
  4. Per-element Format pane parity, smoothed lines, exploded pie, pie/bar of pie, 100% variants: 8–12 h.
  5. 3-D column/bar/pie/area, surface and contour, Pareto: 8–12 h.
  6. Chart sheets, templates and PivotChart field buttons: 5–8 h. Filled map: owner decision on boundary data.

Revision history

Date Change Summary
2026-11-02 minor Charts move and resize from eight handles, each moving only its own edges (#190); resizing leaves the work list (1–2 h, within the 40–60 h rounding)
2026-11-01 minor Chart data tables for column, bar, line, area and compatible combo charts: command/UI controls, formatted source values, blanks, grouped category headers, legend keys, independent borders, shared print/PDF rendering and native c:dTable import/export. Dense tables show a space notice; no readiness score change.
2026-10-29 minor Selected charts highlight their source cells beneath floating objects, so the blue outline no longer crosses the chart; uncovered source cells remain highlighted (#2861)
2026-10-24 minor 100% Stacked Area: inserted from the ribbon and All Charts, drawn as shares of each category's total, read and written as percentStacked
2026-10-18 trivial Stale notes: stock/combo, treemap/sunburst, box and waterfall kinds survive XLSX round-trip (PRs #158, #161)
2026-10-16 trivial Series that refer to defined names ([0]!Name, Sheet!Name) resolve instead of showing #NAME?, and are saved qualified, as Excel needs (#1686)
2026-10-16 minor Box & whisker quartiles default to exclusive, honor each series on draw and XLSX round-trip; chart.set {quartiles} changes the method (#1453)
2026-10-13 minor Multi-level category axes: read, drawn (outer levels under or beside the labels), written back with level caches
2026-10-12 trivial chart sheets are kept on save, still not editable (#727)
2026-10-11 minor Trendlines: all six types modelled, round-tripped through c:trendline, drawn with forecast and equation/R² labels; chart.addElement trendline
2026-10-11 minor PivotCharts (insert.pivotChart)
2026-10-11 minor Recommended Charts dialog with previews (#215)
2026-10-11 minor Select Data dialog with category axis labels; a blank top-left cell makes the first column the categories (#287)
2026-10-10 minor Smooth lines (#62) and Switch Row/Column on file charts (#116) landed; chart resize bug (#190)
2026-10-10 major Created from a source audit: 25 kinds (25 of ~60 subtypes), element gaps, round-trip loss