Skip to content

PatternsTheme

Type module

Sources

Items from PatternsTheme can be imported/included and used via following ways.

/**
* Import via: PatternsTheme.ts
* Access items like: $patternstheme.myVariable
*/
import * as $patternstheme from "@amcharts/amcharts5/PatternsTheme";

Variables

PATTERN_GRAYS

Type ArrayDefault [ Color.fromHex(0x4a4a4a), Color.fromHex(0x818181), Color.fromHex(0x606060), Color.fromHex(0x939393), Color.fromHex(0x545454), Color.fromHex(0x727272) ]

A ramp of gray fills cycled across series (ordered so neighbours contrast), so series differ by tone as well as by their overlaid white pattern. Kept mid-dark enough that the white texture always reads.

PATTERN_STROKE_DASHARRAYS

Type ArrayDefault [ 0, [ 6, 4 ], [ 2, 2 ], [ 10, 5, 2, 5 ], [ 4, 4 ], [ 3, 3 ], [ 12, 5 ], [ 8, 4, 2, 4 ], [ 3, 3 ], [ 14, 6 ], [ 2, 7 ], [ 6, 3, 2, 3 ] ]

Stroke dash arrays cycled across line series (0 = solid), paired with the widths above for extra separation.

PATTERN_STROKE_WIDTHS

Type ArrayDefault [ 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3 ]

Stroke widths cycled across line series (which can't carry a fill pattern), so they are told apart by weight as well as tone.

Functions

buildPatterns(root: Root,
color: Color
)

Returns Array

Builds a fresh, varied set of patterns. One set is made per theme rule (i.e.

per root), shared by all charts of that class — mirroring how the default theme shares a single ColorSet per root.

Angled hatches use each pattern's angle setting (which tiles seamlessly at a small tile size) rather than rotating the whole pattern, and the set mixes in dots, stars, triangles and grids so consecutive series stay easy to tell apart by shape alone.