Skip to content

Keep chart cache point positions when a reference has blank edges (#1015) - #1103

Merged
aiongg merged 1 commit into
storytold:mainfrom
MarekSpodBiedry:issue-1015
Oct 22, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
MarekSpodBiedry:issue-1015

Conversation

@MarekSpodBiedry

Copy link
Copy Markdown
Contributor

Fixes #1015.

ref_values in crates/xlsx/src/chart.rs intersected every chart reference with the sheet's used range, though its comment said this was only for whole columns/rows. The num/str cache writers then numbered the shortened list from 0 while keeping the original <c:f>. So for Data!$A$3:$A$6 with only A4 filled, the cache held one point at idx="0" and ptCount="1", where it should hold idx="1" and ptCount="4". Leading blanks moved later values to lower indices, and trailing blanks made the point count smaller. Category, X and Y ranges filled to different extents fell out of line with each other.

The change:

  • Explicit ranges are now used exactly as written. Every cell has its own position, blank or not.
  • Whole-column ($A:$A) and whole-row references still stop at the used range so the cache stays bounded. Only the far end is cut. The start stays at row 1 or column A, so indices still match the reference.
  • The MAX_CACHE limit is unchanged.

chartex.rs calls the same ref_values, so the chartex point lists get the same fix.

Tests (crates/xlsx/src/tests/chart_ref_offsets.rs), both fail on main:

  • explicit_range_keeps_leading_and_trailing_blanks: A3:A6 with only A4 set gives [Empty, 5, Empty, Empty]. Main gives [5].
  • whole_column_still_stops_at_used_range_and_starts_at_top: $A:$A gives four points that end at the last used row and start at row 1. Main gives [5].

@MarekSpodBiedry
MarekSpodBiedry marked this pull request as ready for review October 13, 2026 16:10
@aiongg
aiongg merged commit 37bf37d into storytold:main Oct 22, 2026
1 check passed
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.

fix(xlsx): chart cache generation trims explicit ranges and shifts point indices

2 participants