Skip to content

docs(charts): the recipe documents the styling surface it has - #502

Merged
DemchaAV merged 1 commit into
developfrom
docs/chart-styling-reference
Aug 4, 2026
Merged

docs(charts): the recipe documents the styling surface it has#502
DemchaAV merged 1 commit into
developfrom
docs/chart-styling-reference

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Aug 4, 2026

Copy link
Copy Markdown
Owner

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 are
load-bearing in the flagship examples that put a chart on a dark card. The only way
to find them was to read ChartStyle.Builder.

valueLabelHalo was documented under line charts, the one place its default white
chip 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 ChartTheme was presented as a layer an author styles through. A chart placed
through 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 from
ChartDefaults.DEFAULT_THEME and ChartStyle is the author-facing override. The
low-level ChartLayoutResolver.resolve(...) does take an explicit ChartTheme
the page now draws that line rather than implying either that the theme is a knob
or that nothing accepts one.

What

  • Every ChartStyle setting in one table with its default and what it applies to,
    marking which are inherited from ChartDefaults.DEFAULT_THEME and which are fixed
    engine defaults.
  • A section for the halo of its own: what it is for, why white is wrong off a white
    page, and translucency through withOpacity(...).
  • A typography section for the three chrome text styles; donutCenterTextStyle
    documented beside the centerText it styles; barWidthRatio in the bar section.
  • ChartStyleDocumentationGuardTest reflects over ChartStyle.Builder and fails the
    build when a setter is not named on the page.

Tests

  • ./mvnw -B -ntp clean verifyBUILD SUCCESS.
  • The guard was confirmed able to fail: with barWidthRatio and donutCenterTextStyle
    removed from the page it reported exactly those two.
  • The three new snippets carry doc-example markers, so DocumentationSnippetCompileTest
    compiles them against the current API; breaking valueLabelHalo produced a compiler
    error attributed to charts-halo.

Base

Rebased onto develop at #501, which is what makes the halo section true for every
chart kind: grouped-bar value labels passed null until that fix, so the page would
otherwise have promised behaviour the default bar chart did not have.

@DemchaAV
DemchaAV force-pushed the docs/chart-styling-reference branch from 81776a6 to df0ae30 Compare August 4, 2026 09:51
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.
@DemchaAV
DemchaAV force-pushed the docs/chart-styling-reference branch from df0ae30 to 6db4b0c Compare August 4, 2026 10:05
@DemchaAV

DemchaAV commented Aug 4, 2026

Copy link
Copy Markdown
Owner Author

All three are real, and the branch is now rebased on develop at #501, so the halo section is unconditionally true — both BarChartLayout call sites pass halo.

1. ChartTheme. You are right and my claim was simply too wide. ChartLayoutResolver is a public final class, resolve(...) is public static with no @Internal, it takes a ChartTheme, and ChartTextMetrics is a public interface — so the seam is genuinely callable, not theoretical. The page now separates the authoring path (always ChartDefaults.DEFAULT_THEME, ChartStyle is the override) from the geometry seam that does accept a theme; CHANGELOG says "no authoring API accepts one".

This one had a second half neither of us named: the layers table at the top called ChartLayoutResolver an "internal pure function (data, spec, style) → primitives" — internal for something public, and a signature that does not exist (the real one is (spec, style, theme, width, height, metrics)). Fixed in the same pass, since it is the same error one layer up.

2. Footnote. Confirmed: lineWidth and valueLabelOffset live in package-private ChartLayoutSupport, areaOpacity is private in LineChartLayout, sliceGapDegrees is a literal in PieChartLayout, and pointMarker / square corners are the absence of an override rather than any constant. Reworded to your form, with the nuance kept that three unmarked rows (barWidthRatio, sliceStroke, donutCenterTextStyle) are ChartDefaults constants.

3. valueLabelOffset on pie/donut. Confirmed at PieChartLayout:61 and :114valueLabelGap(style) sets the radial gap between the rim and the slice label. Fixed in both the table row and the prose.

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.

clean verifyBUILD SUCCESS. Amended rather than stacked a fix commit, so the branch is still one commit.

@DemchaAV
DemchaAV merged commit d63e91b into develop Aug 4, 2026
12 checks passed
@DemchaAV
DemchaAV deleted the docs/chart-styling-reference branch August 4, 2026 10:24
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.

1 participant