docs(charts): the recipe documents the styling surface it has - #502
Conversation
81776a6 to
df0ae30
Compare
Five ChartStyle settings were named nowhere on the page — the three text styles, the donut centre style and the bar width ratio — four of them already load-bearing in the flagship examples that put a chart on a dark card. The value-label halo was filed under line charts, the one place its default white chip is least likely to be wrong, rather than described as the backing behind value and slice labels alike. And ChartTheme was presented as a layer an author styles through, though no authoring API accepts one; the low-level ChartLayoutResolver.resolve(...) does, and the page now draws that line rather than leaving it out. The page now carries every setting with its default and what it affects, plus compiled examples for typography and for the halo. ChartStyleDocumentationGuardTest fails the build when a setter reaches the builder without reaching the page.
df0ae30 to
6db4b0c
Compare
|
All three are real, and the branch is now rebased on 1. This one had a second half neither of us named: the layers table at the top called 2. Footnote. Confirmed: 3. Worth noting where the guard's limit is: it checks that each setter is named on the page, so it would not have caught any of these three. They are claims about behaviour, not missing names — that part still rests on review.
|
Why
The chart recipe is the only page describing chart styling, and it had drifted from
the builder in three ways.
Five settings appeared nowhere on it —
axisTextStyle,legendTextStyle,valueLabelTextStyle,donutCenterTextStyle,barWidthRatio— though four areload-bearing in the flagship examples that put a chart on a dark card. The only way
to find them was to read
ChartStyle.Builder.valueLabelHalowas documented under line charts, the one place its default whitechip is least likely to be wrong, rather than as the backing behind value and slice
labels alike. The single setting that must change when a chart leaves a white page
was filed where a bar or donut author would not look.
And
ChartThemewas presented as a layer an author styles through. A chart placedthrough the DSL resolves its geometry during the layout pass, after the document's
theme is out of reach (
ChartDefinition.java:67), so it always starts fromChartDefaults.DEFAULT_THEMEandChartStyleis the author-facing override. Thelow-level
ChartLayoutResolver.resolve(...)does take an explicitChartTheme—the page now draws that line rather than implying either that the theme is a knob
or that nothing accepts one.
What
ChartStylesetting in one table with its default and what it applies to,marking which are inherited from
ChartDefaults.DEFAULT_THEMEand which are fixedengine defaults.
page, and translucency through
withOpacity(...).donutCenterTextStyledocumented beside the
centerTextit styles;barWidthRatioin the bar section.ChartStyleDocumentationGuardTestreflects overChartStyle.Builderand fails thebuild when a setter is not named on the page.
Tests
./mvnw -B -ntp clean verify→BUILD SUCCESS.barWidthRatioanddonutCenterTextStyleremoved from the page it reported exactly those two.
doc-examplemarkers, soDocumentationSnippetCompileTestcompiles them against the current API; breaking
valueLabelHaloproduced a compilererror attributed to
charts-halo.Base
Rebased onto
developat #501, which is what makes the halo section true for everychart kind: grouped-bar value labels passed
nulluntil that fix, so the page wouldotherwise have promised behaviour the default bar chart did not have.