Skip to content

ColorEncoding

Defined in: packages/pixi-charts/src/spec/ChartSpec.ts:51

Color channel encoding.

For line / area / bar this is always categorical: the field’s distinct values produce one series (or one per-bar color) each — type is ignored by those charts. ScatterChart (Session 7) is the first chart to support a quantitative color field, mapped through a continuous sequential scale instead of a discrete palette.

field: string

Defined in: packages/pixi-charts/src/spec/ChartSpec.ts:53

Name of the column to colour by.


optional scheme?: string

Defined in: packages/pixi-charts/src/spec/ChartSpec.ts:74

Colour scheme name. For categorical fields, one of the categorical scheme names (import(’../core/ColorScheme.js’).categoricalSchemes); for quantitative fields, one of the sequential scheme names (import(’../core/ColorScheme.js’).sequentialSchemes). When omitted the chart picks a sensible per-type default (category10 for categorical, viridis for quantitative).


optional type?: "categorical" | "quantitative"

Defined in: packages/pixi-charts/src/spec/ChartSpec.ts:65

How the colour field is interpreted:

  • 'categorical' — each distinct value gets a discrete colour from a categorical palette.
  • 'quantitative' — values are mapped through a continuous sequential colour scale (e.g. viridis), paired with a continuous legend.
  • omitted — treated as categorical. (Line/area/bar are categorical-only and ignore this field; scatter must set 'quantitative' explicitly to opt into continuous colour.)