* Charts: series drawn and saved by their own kind; XLSX groups per drawn kind
Chart::series_kind is the one rule for the kind each series is drawn as: in a
combo its own kind (the first a column and the rest lines by default; bars
stand upright as columns), elsewhere the chart's kind, keeping a line's own
markers or a scatter's own lines (same_family). The renderer, legend, data
table and trendline eligibility all ask it; chart.set drops the series kinds a
new type doesn't draw.
The XLSX writer writes one group per drawn kind on each axis (areas, stacked
columns kept), axes of the kind those groups need, a one-kind chart's
secondary series on their own axes, and a stock group only for 3 or 4 series.
The reader keeps each series' markers and lines, treats groups of one family
as one chart, takes the primary axes from the value axis on the left or
bottom, and orders series by c:order.
* XLSX charts: one pie group, one group per type per axis pair, scatter markers kept
Review fixes for the per-kind chart groups:
- Pies and doughnuts have no axes: series marked secondary stay in the one
group, so a combo turned into a doughnut no longer writes two doughnuts.
- One group per type on a pair of axes, as Excel keeps them: clustered and
stacked columns (lines and stacked lines, areas and stacked areas) share the
first one's grouping instead of writing two groups on the same axes.
- A markers-only scatter (or bubble) series drawn among lines keeps its markers.
- chart-parity.md: the revision row moves under Revision history.
* Charts: one grouping per type and axis pair, drawn as saved; combo pies as columns
Second review round for the per-kind chart groups:
- Chart::series_kind gives the series of one type (columns, lines, areas) on
one pair of axes in a combo the first one's grouping, as the XLSX writer
saves them, so a stacked column beside clustered ones no longer un-stacks
after save and reopen. Chart::series_kinds computes them in one pass.
- A combo's pies and doughnuts are drawn as columns (as the renderer does);
only a chart without axes ignores secondary flags, so a combo with a
secondary pie keeps its primary axes and writes the pie where it is drawn,
and a pie + doughnut combo is one column group.
- Groups that fit the axes come before groups moved onto them, and each
group writes its series in their own order.
- The unreachable bubble arm in series_xml is gone.
* Charts: combos drawn and saved on category axes; data tables by series_kinds
Third review round for the per-kind chart groups:
- A combination chart is drawn on category axes, so Chart::series_kind gives
its scatter and radar series as lines (a markers-only scatter with markers)
and its bubbles as columns, as the renderer draws them; the XLSX writer uses
category axes for every combo, so a scatter or bubble series first no longer
turns the other series into scatter series.
- supports_data_table uses series_kinds (one pass, it runs every frame).
- A same-family kind left in an older JSON workbook is drawn, tested and
documented rather than migrated: it can't be told from a file's own.
* Charts: combo chartex series as columns; empty charts survive XLSX; a new type applies to every series
- `combo_series_kind` draws a combo's histogram, waterfall, funnel, treemap, sunburst and box &
whisker series as clustered columns, as the XLSX writer already saved them: their grouping,
combo-ness and data-table support no longer change on reopening.
- The XLSX writer writes one empty group of the chart's kind (a line group for stock) when a
chart has no series, so the chart is read back rather than dropped.
- The XLSX reader looks the value axes' positions up in a map built once; a file with many
chart groups took quadratic time to read.
- `chart.set` with a new type (other than a combo) clears every series' own kind, so choosing a
type applies it to every series again (a file's markers no longer outlive a type change);
setting the type a chart already has drops only the kinds it does not draw.
- docs/chart-parity.md: combo scatter series are lines with markers, and only stock series
beside stacked lines are still saved stacked but drawn unstacked.
* Charts: one model rule reads per-series kinds back; empty charts keep their kind in XLSX
- `Chart::set_drawn_kinds` sets a chart's kind and its series' own kinds from the kinds a file
draws each series as (one family: the first's kind, a series keeping its own only where it
differs; otherwise a combo). The XLSX reader now uses it, so an ODS reader can share the rule
instead of copying it.
- An empty line group writes `c:marker val="0"` when the chart has no markers, and an empty
scatter group `scatterStyle val="marker"`: an empty Line chart no longer reopens with markers,
an empty Scatter chart no longer with lines, an empty stock chart as a Line chart. The test
now checks the kind read back; the previous commit's test listed Waterfall, which goes
through the column writer there and proved nothing (empty chartex charts are still not kept,
as before this branch; documented).
- `drop_foreign_series_kinds` is removed: since the previous commit, `chart.set` clears every
series' kind on a change of type, and the helper only ran when the same type was set again,
where `series_kind` already ignores kinds outside the chart's family.
- `series_kind`'s doc states the combo conversions and the same-family rule; the combo row in
docs/chart-parity.md lists every conversion.
* XLSX charts: an empty group sets neither the chart's kind nor its axes
The reader took the chart's first kind and its primary axes from the first group even when that
group held no series, so a file with an empty bar group before a scatter group read as a scatter
chart whose only series was secondary, with the bar group's axis titles. Empty groups are now
left out when any group has series, and the axis titles come from the primary pair's axes
(found by id, in any order), else the first axis of their kind as before.
* XLSX charts: axis titles from shown axes, by the primary pair's kind
Corrects the previous commit's axis lookup. When a file's only series sit on a pair whose
category axis is deleted, beside an empty group on shown, titled axes, the x title came from the
deleted axis (none) instead of the shown one: a shown axis of a kind is now taken before a
deleted one. And whether the axes are a scatter's two value axes is now decided by the group on
the primary pair, not the first group with series, so a secondary line group listed before a
primary scatter no longer gives the y axis the scatter's x title.
* Charts: the stacked hairline-bar budget test draws stacked columns
Resolved series carry the kind they are drawn as (Chart::series_kind), and the test's data
defaulted every series to clustered columns, so after the merge with main it no longer drew a
stacked chart and passed without testing stacked spans. Its series are now stacked columns.
* Charts: SeriesData::kind says render draws every series by it
* XLSX charts: the many-groups test reaches the axis lookup and is timed
* chart.addElement: trendlines for every series check their kinds in one pass
A combo series' kind looks back for the first series of its group, so
asking it per series was quadratic in a chart with many series. The
all-series path now uses Chart::series_kinds() once.
Test: trendlines_for_every_series_are_checked_in_linear_time (120,000
series: 0.06 s with the fix, 17.8 s without in a debug build).
* xlsx: a lone stock series joins the line group on its axes, keeping its grouping
A stock series too few for a stock group falls back to a line. It used to
be kept in order with the other groups, so when it came first its plain
line group took in the stacked lines after it and saved them unstacked.
The fallback now joins after the other groups, so an existing line group
keeps its grouping; with none, it is still a plain line.
Test: a_lone_stock_series_does_not_unstack_the_lines_beside_it.
* model: set_drawn_kinds stores each combo series's kind as it is drawn
Series of one type on one pair of axes share the first one's grouping
(series_kinds draws and every format saves them so), but set_drawn_kinds
stored the file's kinds as given: a stacked column after a clustered one
on the same axes was kept as stacked while drawn and saved clustered. It
now stores the drawn kind; on the other axes a series keeps its own.
Test: drawn_kinds_of_one_type_share_a_grouping_per_pair_of_axes.
* tests: linear-time chart checks count their work at two sizes instead of timing it
`many_groups_are_read_in_linear_time` and
`trendlines_for_every_series_are_checked_in_linear_time` asserted a four-second
wall-clock bound, which fails on a busy machine and doesn't show how cost grows.
Each now counts the steps its code takes, with a counter that exists only in
tests, at n and 8n, and asserts the larger run did less than 16 times the
smaller one's work (linear is about 8 times, quadratic about 64). The output
checks stay.
- xlsx: a cfg(test) counter of value axes visited while finding the primary
axes.
- model: a `work` counter of series a combo chart's kind lookups visit, behind
a new `test-support` feature (as gridcraft-xlsx has) so engine tests can read
it; engine's dev-dependency enables it. Shipped builds don't have it.
Against the quadratic versions (value axes scanned per group; series_kind
asked per series) the tests fail with 2,886,000 visits against 45,750 and
2,566,398 against 40,798.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chart: bound scan conversion, spline points and category label bytes
- The rasteriser tested every edge of a path at every sub-sample of every
covered row. It now keeps an active-edge list (edges sorted by top, joining
and leaving as the scan passes them), and one rasterize call has a total
scan-work allowance after which remaining fills are skipped.
- Smoothed lines budgeted interpolated points per run, so gap-separated short
runs escaped both decimation and the cap. The budget is now shared by all
runs of a line; once spent, runs are drawn through their data points.
- Category labels copied every text value in full. Labels are clipped to 255
characters before copying, within an 8 MiB budget per series.
* address review: chart raster and label budget fixes
* address review: bound polyline point count before stroke_paths
A series like =FreshClock, where the workbook name FreshClock is NOW(),
was cached because only the literal series text was searched for
volatile calls. The check now also follows defined names the formulas
use (workbook or sheet scope, bare or sheet-qualified, LAMBDA names),
the way the evaluator looks them up. Nesting deeper than 8, cycles and
more than 64 lookups per chart count as volatile, so a chart whose
stability isn't established is not cached.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The width of a prefix plus an ellipsis is not monotone when the text has a
line break, so the binary search could drop a label that fits. Also pass the
series index to plot_kind in the data table (upstream/main does not compile
without it).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Read only the cells the category levels use and cut the category dimension
at the per-series cap, so a multi-level axis keeps all its levels.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Move retain_docs out of the per-chart paint path into SheetApp::logic so closed
documents are forgotten even when no chart is painted. Charts whose series call
NOW, TODAY, RAND, RANDBETWEEN or RANDARRAY bypass the cache because their
resolved values change between evaluations.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Charts: draw every doughnut series as a ring (#1827)
* Charts: submit doughnut hole size and first slice angle when the drag ends (#1827)
---------
Co-authored-by: alosslessdev <alosslessdev@users.noreply.github.com>
Addresses review comments 4455115540 and 4455115557. The parser stores
`'Sheet'!Name` as `Sheet!Name` with the sheet already unquoted:
- Evaluator::name split it at the first `!`, so a series named
`'a!b'!Title` showed #NAME?.
- chart_name unquoted it again, trimming spaces, so a chart reference
to `' Sales '!Data` was saved as `Sales!Data`.
Both now split at the last `!` and look the sheet up as is.
Tests: chart tests::a_series_named_by_a_name_on_a_sheet_with_a_bang_resolves,
xlsx tests::chart_book_names::chart_names_keep_spaces_around_a_quoted_sheet_name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three places still split a `Sheet!Name` reference and stripped the
sheet's quotes by hand: the chart resolver (is a series name a defined
name?), the XLSX chart writer (the name's cache) and the macro editor's
example references. The first two left a doubled quote in the name, so
a series named `'Bob''s'!Title` (a name on the sheet "Bob's") wasn't
found and showed that text instead of the name's value; they also split
at the first `!`, so a quoted sheet holding one broke. All three now use
core's split_sheet, the one reading formulas use.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add command and UI controls for chart data tables, shared chart and PDF rendering, and native XLSX persistence. Cover live values, blanks, formatting, alignment, undo/redo, bounds and table flags with regression tests.
Co-Authored-By: Codex <noreply@openai.com>
render.rs was split into render/ modules on main; the plot-kind and fixed-scale cleanups are re-applied in the new modules.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
render.rs was split into render/ modules on main; the label-fitting, legend and treemap changes are re-applied in the new modules.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
render.rs was split into render/ modules on main; the budget and hairline-bar changes are re-applied in render.rs and render/cartesian.rs.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Sonar: explicit imports, fn paths for closures, extract helpers for cognitive complexity
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Fix imports
* Fix serde imports
* Fix engine imports
* Fix clippy gate and a type error from the explicit-import change
Remove the unused imports the review flagged (cf.rs, pivot.rs, tables.rs, cmd/sheet.rs) so clippy -D warnings passes, and point the backstage parent-folder lookup at Path::to_str, which the fn-path rewrite had broken.
Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
* Apply rustfmt to the explicit-import cleanup so the fmt gate passes
* Share the per-directory font path expansion in theme.rs
The candidate font lists repeated the same loop over the Linux font
directories in every role. A single helper expands them in the same order,
so the lookup order is unchanged and the duplicated blocks go away.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
* Read the Windows fonts folder in one place in theme.rs
Every script-font list repeated the same WINDIR lookup. A single helper
returns the same path, so the duplicated lines go away without changing
which font files are tried.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
* Build the light and dark UI palettes from one table in theme.rs
Tokens::light() and Tokens::dark() listed the same 40 colour fields in the
same order, so every change had to be made twice. A single palette
constructor takes the mode and picks each colour's value, so each field is
written once and both modes keep their exact colours.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
* Share the Noto CJK font list between the CJK script lists in theme.rs
The Japanese, Simplified and Korean lists each repeated the same loop over
the Linux CJK directories with a different locale file name. One helper
builds that loop, and each list keeps its own face index, so the lookup
order is unchanged.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
* Share Linux Noto directory list across Thai and Hebrew font lookups
Removes the duplicated directory arrays flagged by SonarCloud new-code duplication.
* Reuse in_dirs for Thai and Hebrew Noto font candidates
Removes the remaining duplicated per-directory loops flagged by SonarCloud.
* Share one font-list builder for the Thai and Hebrew faces
The two per-script functions repeated the same Windows, macOS, Linux and
variable-font setup. A single script_fonts helper now builds both lists,
keeping the candidate order unchanged, which clears the Sonar duplication gate.
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Codebuff <noreply@codebuff.com>
Insert > Line or Area and the All Charts list offer 100% Stacked Area,
and insert.chart and chart.set take it as type area with subtype
stacked100. Each series' area stacks on the ones before it as its
share of the category's total. When every series on the value axis is
100% stacked and no value is negative, the axis runs from 0% to 100%.
A blank cell counts as zero, and a category whose total is zero stays
on the baseline.
An XLSX area chart with percentStacked grouping now opens as 100%
stacked and is saved back as percentStacked. It used to open as a
stacked area and was saved as stacked.
- floating_pictures: draw without retaining when eviction can't free
enough room, so a large workbook can't pin the cache past its budget
- xtask stats: skip unreadable subtrees instead of aborting the walk
- import-cert.sh: per-run private temp dir instead of predictable
paths in a shared root
- gridcraft-web: gate clipboard ops behind user activation
- chart raster: cap dash rendering to the stroked budget
- cli check: mark directories visited by identity on unix so hard-link
loops can't recurse; reuse one decompression of a reused part