Skip to main content

Module series_pattern

Module series_pattern 

Source
Expand description

SeriesPattern — the non-colour channel that identifies a chart series.

A chart that tells its series apart by colour and nothing else fails WCAG 1.4.1 (Use of Color), whatever palette it uses. A CVD-safe palette like Okabe–Ito answers a different question — whether the colours are distinguishable from one another — and does not answer this one: a reader with monochrome vision, a monochrome printout, a display in bright sun, or a forced-colours setting has no colour channel at all. It also does not answer the wrap-around problem, where a ninth series repeats the first’s colour exactly.

So every series carries a second, orthogonal identity: a pattern. One value drives all three renderings a chart needs, so a series looks like itself whether it is drawn as a line, a bar, a slice, or a legend swatch:

linemarkerfilled area
Solidsolidcircleplain
Dashedlong dashsquare45° hatch
Dotteddottedtriangleback-hatch
DashDotdash-dotdiamondcross-hatch
ShortDashshort dashcrosshorizontal
WideDashwide dashplusvertical

Six patterns against the theme palette’s eight colours means the pair (colour, pattern) does not repeat until the 24th series — where colour alone repeated at the 9th.

A series with no explicit pattern is assigned one from its position by SeriesPattern::for_index, so the channel exists without any application code. Whether a chart draws it is the chart’s decision (the stock charts draw it once more than one series is visible, since a single-series chart has nothing to disambiguate).

Enums§

SeriesHatch
How a filled region (a bar, an area, a pie slice) carries its series’ pattern. None is a plain fill; the rest are line hatches at the named angle, drawn in a contrasting tone over the fill.
SeriesMarker
The marker glyph drawn at a line chart’s data points, and next to a series in a legend. Shape, not colour — that is the whole point.
SeriesPattern
The non-colour visual channel identifying one chart series.