Skip to content

spec: write each fill property only for the marks that draw it - #100

Merged
timzifer merged 1 commit into
mainfrom
fix/spec-fill-per-mark
Nov 20, 2026
Merged

timzifer merged 1 commit into
mainfrom
fix/spec-fill-per-mark

Conversation

@timzifer

Copy link
Copy Markdown
Owner

Fixes #98.

fill() in writeMarkProps is split into parts (colour, opacity, hatch, gradient, corner, inset); each case writes the parts its mark draws. Rule: a part counts as drawn when it changes the output, legend swatch included (e.g. a violin rounds no corner, but its SwatchBox legend does — dropping it would change the legend after a round trip).

Determined per geom type by tracing every read of the fill fields and helpers (fillMark → gradient+hatch+inset, paint, hatchingOf, insetOf, fillOf/fillFor, boxSwatch and legends(SwatchBox) → hatch+corner, nodeLegends/oneNodeLegend); marker and line swatches carry no hatch or corner.

Narrowed (over-reports removed):

Mark Now writes
Scatter Fill, Opacity (opacity only reaches bubbles)
Hexbin, QQ Fill
Bar, Rect all but Opacity
Candle Hatch, Gradient, Corner, Inset — body colour is the direction's
Venn, HBand, VBand, Region Fill, Opacity, Hatch, Corner
Horizon, Beeswarm none

Added (under-reports — a round trip lost them): Survival (confidence band: all but Corner), SetMatrix (Hatch, Corner — its box swatch), Text (Fill — picks the label ink), Tree (Opacity).

Decoding is unchanged and lenient: an older document with corner on a scatter still reads, and the property is ignored as before. internal/markprops and the matrix in geom's doc are regenerated; the doc's caveat about the fill group is replaced by the rule. All spec round-trip and golden tests unchanged.

https://claude.ai/code/session_015BfhXWEPyCFY4fZhg5nzsh

writeMarkProps wrote the whole fill group — fill, opacity, hatch,
gradient, corner, inset — for every mark that fills, so a document could
name a corner on a scatter or a gradient on a band, neither of which is
drawn. It now writes per part, and a part counts as drawn when it
changes the picture, the legend's swatch included: a violin rounds no
corner of its own but its swatch does.

Narrowed: scatter (fill, opacity), hexbin and qq (fill), bar and rect
(no opacity), candle (no fill colour or opacity — a body takes its
direction's), venn and the bands and region (no gradient or inset),
horizon and beeswarm (none).

The same reading found four marks that draw a fill property the encoder
never wrote, so a round trip lost it: survival's confidence band takes
the fill like an area, set-matrix's box swatch takes the hatch and the
corner, a text layer's fill picks its ink, and a tree's branches fade by
the opacity. Those are written now.

internal/markprops follows, the option matrix in geom's doc is
regenerated, and the caveat about the fill group is replaced by the rule.

Fixes #98

Claude-Session: https://claude.ai/code/session_015BfhXWEPyCFY4fZhg5nzsh
@timzifer
timzifer merged commit 0df2e34 into main Nov 20, 2026
31 of 32 checks passed
@timzifer
timzifer deleted the fix/spec-fill-per-mark branch November 20, 2026 06:35
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.

spec: the fill properties are written for marks that do not draw them

1 participant