Implement Charts - #683
Open
ddimaria wants to merge 1 commit into
Open
Implement Charts#683ddimaria wants to merge 1 commit into
ddimaria wants to merge 1 commit into
Conversation
ddimaria
force-pushed
the
implement-charts
branch
from
July 20, 2026 20:36
30a8fe2 to
d69ae3c
Compare
ddimaria
force-pushed
the
implement-charts
branch
3 times, most recently
from
September 17, 2026 13:29
09469f1 to
8c4c572
Compare
Add three related xlsx reading features in a single commit. Cell styles and worksheet layout: - `Xlsx::worksheet_style(sheet)` returns a row x col grid of cell styles using run-length encoding for memory efficiency on large workbooks. - `Xlsx::worksheet_layout(sheet)` returns column widths and row heights. - Style types in `src/style.rs`: `Style` with optional Font / Fill / Borders / Alignment / NumberFormat / Protection, `Color` with theme + tint resolution and indexed-color fallback, `RichText` / `TextRun` for cells with mixed inline formatting, and `StyleRange` with RLE storage and a `cells()` iterator. - Parser in `src/xlsx/style_parser.rs` handles fonts, fills, borders, number formats (built-in + custom), alignment, protection, theme colors with tint, and sysClr lastClr fallback. - Shared-string reader now decodes rich text runs and preserves their formatting, while also handling plain text that precedes rich runs (consistent with upstream PR tafia#637). Conditional formatting: - `Xlsx::worksheet_conditional_formatting(sheet)` parses `<conditionalFormatting>` blocks including rule types, operators, cfvo thresholds, dxf styles, color scales, data bars, and icon sets. Charts: - `Xlsx::worksheet_charts(sheet)` reads chart definitions from drawing relationships (`src/chart.rs`, `src/xlsx/chart_parser.rs`), covering bar, line, pie, area, scatter, radar, and combo charts, including series ranges, titles, axes, legends, and styling. Includes benchmarks in `benches/style.rs` and test fixtures covering the various code paths.
ddimaria
force-pushed
the
implement-charts
branch
from
September 17, 2026 14:17
8c4c572 to
6e0f337
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds chart reading to the XLSX reader via two new methods:
The reader walks the worksheet (or chartsheet) relationships to the drawing part, collects the anchored chart frames (two-cell, one-cell and absolute anchors, including their positions), and parses each chart part into a public
Chartdata model in the newchartmodule. The API is modelled afterrust_xlsxwriter's chart types so the two crates feel symmetrical (write withrust_xlsxwriter, read back withcalamine).Also exposes the workbook theme palette:
ThemeColorshas named slots (dark1/light1/dark2/light2,accent1–accent6,hyperlink,followed_hyperlink), parsed once fromxl/theme/theme1.xml, cached and reused by chart/style/conditional-formatting parsing, and falling back to the default Office palette (never errors). Consumers need it to color unstyled chart series the way Excel does (the theme accent cycle) without re-opening the package themselves.Supported
standardvsclustered3D grouping distinguished), wireframe/contour surfaces, and combo charts (multiple plot groups per chart).xl/charts/chartExN.xml): funnel, treemap, sunburst, histogram, pareto, box & whisker, waterfall and filled map, including themc:AlternateContentdrawing anchors, thechartExrelationship type, and per-series layout options (ChartExLayout: histogram binning, waterfall subtotals/connector lines, box & whisker statistics and element visibility, treemap parent label layout).c:dLbloverrides with delete/custom text/position), trendlines (all six types), error bars, invert-if-negative.c:crossAx), cross-between, display units, gridlines, number formats, titles, fonts and label text rotation.rotX/rotY/perspective/depth, per Correct MBSC to MBCS in vba.rs #180 in rust_xlsxwriter), gap/overlap, hole size, first slice angle, bubble scale/size-represents, pie-of-pie split settings (includingc:custSplitpoint lists), up/down bars, drop lines, high-low lines, series lines, data tables,dispBlanksAs, and the chart-space flagsautoTitleDeleted/plotVisOnly/showDLblsOverMax/date1904.ChartPositioncarries the anchor cells/extents pluseditAs(move/size behavior) and the absolute anchor x/y position.Not read (documented in the module docs)
Pivot chart sources, manual plot-area layouts, and surface band formats.
Test plan
tests/charts.xlsxfixture (pre-generated, committed totests/per the feedback on feat(xlsx): implement cell style extraction with rich text and worksheet layout #653 — no generator or dev-dependency added) with 18 classic charts + 5 chart-ex charts exercising every family and the options above.resolve_chart_typemapping tests, theme palette tests against both a default-theme and a real Excel theme, and a real Excel-generated chartsheet (tests/issue438.xlsx).--all-features; clippy and rustdoc clean.Notes
Stacked on #653 (styles) and #628 (conditional formatting); the first two commits here are those PRs. Only the
feat(xlsx): implement chart readingcommit is new — happy to rebase once the parents land.