fix(charts): a bar's value label gets the halo the style asks for - #501
Conversation
The halo chip exists so a grid line stops running through the digits. BarChartLayout resolved the colour from the style and then passed null for every value label except a stacked total — a hardcoded argument forty lines from a sibling call that passed the real one. The style accepted a halo, the layout computed it, and the label was drawn without it. Line charts and donuts had it all along, which is why nobody noticed: the 1.8.0 release notes already promise the chip for a label sitting at a "marker or bar top", while the javadoc on ChartStyle, ChartTheme and ChartDefaults each called it a line-chart feature. Three descriptions of the same gap kept it invisible; all three now say what the code does. Two arguments. Every emitChipLabel call site in the engine passes the resolved colour, so vertical, horizontal, stacked and pie labels behave alike. Six committed previews carry a bar chart with outside labels and are re-rendered: chart-showcase, engine-deck, engine-deck-v2, feature-catalog, financial-report (pdf and pptx). All six draw their charts on a light surface, so the themed white chip is invisible as a fill and shows only as the grid line stopping cleanly at each number; on financial-report page 1 the pixel diff is a single row. The two decks needed a second generation pass because they embed thumbnails of the other documents. The carousel asks for a chip in its own card colour, which is what surfaced this. ./mvnw -B -ntp clean verify — BUILD SUCCESS, 692 tests in the closing module. ChartLayoutResolverTest 38 -> 40; both new cases confirmed red against the reverted engine, along with the existing minimal-chart test whose ShapeNode count now includes the chips.
|
Both blockers fixed. Head is now Blocker 1 — the two Both restored. The commit's carousel diff is now four lines, all additions, all halo: Regenerated and re-ran the drift gate afterwards: green, and no committed preview moved — the carousel is in Blocker 2 — the stacked history. Rebased with The documentation point, folded in rather than deferred. It was not one place but three, all saying line-chart:
All three now read "chart value labels … where a grid line or a stroke crosses them". Leaving them would have kept the next reader believing the thing this PR just disproved.
|
73e513e to
cea5ebd
Compare
Why
ChartStyle.valueLabelHalopaints a chip behind a value label so a grid line stops running through the digits. On a bar chart it did nothing.BarChartLayoutresolves the colour from the style — and then passesnullfor every value label except a stacked total. A hardcoded argument, forty lines from a sibling call that passes the real one. The style accepted a halo, the layout computed it, the label was drawn without it.Line charts and donuts had it all along, which is why nobody noticed. Three separate places describe this as a line-chart feature while the 1.8.0 release notes promise the opposite:
CHANGELOG.md(1.8.0): value labels sit "from the marker or bar top" behind "a configurable halo chip";ChartStyle.valueLabelHalojavadoc: "behind line-chart value labels";docs/recipes/charts.md: the halo paragraph lives under Line, smooth, and area charts.What changed
BarChartLayoutpasses the resolved colour at both remaining sites — vertical (:144) and horizontal (:341). EveryemitChipLabelcall in the engine now behaves alike: vertical, horizontal, stacked and pie.ChartLayoutResolverTest38 → 40. The new cases assert the chip carries the colour the style names rather than merely that a chip appears — a dropped argument falling back to the theme default would otherwise pass — plus that it is emitted before its label (or it would cover the digits) and is wider than the text box. Horizontal bars are pinned separately, so fixing one orientation cannot look complete.minimalChartHidesGridAxesButKeepsBarsAndValueLabelscountedShapeNodes and asserted "only the bars and their value labels remain". The chips areShapeNodes too, so 2 → 4, with the reason in the comment.LinkedInCarouselExampleasks for a chip in its own card colour — the report that surfaced this.Blast radius, measured rather than estimated
I expected the themed white default to paint white rectangles across every dark bar chart. It does not. The drift gate enumerated exactly six committed previews, and all six draw their charts on a light surface:
chart-showcase.pdf·engine-deck.pdf·engine-deck-v2.pdf·feature-catalog.pdf·financial-report.pdf·financial-report.pptxIn each, the only change is the grid line stopping cleanly at each number. On
financial-reportpage 1 the pixel diff is a single row — the gridline pixels now covered. No label moves. The one dark chart in the repository is the carousel, and it names its own colour.The
.pptxchanging is worth noting: the chip survives the second backend, so PDF and deck stay geometrically identical, which slide 2 of that carousel claims in prose.Verification
./mvnw -B -ntp clean verify—BUILD SUCCESS, exit 0, 692 tests in the closing module.CommittedAssetDriftTestgreen.Both new tests confirmed red against the reverted engine (3 failures, including the updated existing one).
One thing the pipeline taught us: after the first regeneration
engine-deckandengine-deck-v2still drifted. They embed rendered thumbnails of the other documents, so they need a second pass to pick up the refreshed inputs. It converges in two; worth knowing before the next change that moves many renders at once.Follow-up, not in here
The javadoc and the chart recipe still file the halo under line charts, and the recipe documents 11 of
ChartStyle's 16 settings —valueLabelTextStyle,axisTextStyle,legendTextStyle,donutCenterTextStyleandbarWidthRatioare absent. The code now behaves correctly; the prose that taught the misconception is a separate change.Lane: shared-engine + examples. No public API change.