Skip to content

PlotSpec

PlotSpec = object

Defined in: spec/plot.ts:34

One layer of marks over one frame.

Deliberately free of geometry: no width, height, margin, pixel, cell, font or colour literal appears anywhere in this type. The spec states intent; the renderer owns every measurement. Anything expressed in output units would make the spec renderable by exactly one adapter.

optional annotations?: readonly AnnotationSpec[]

Defined in: spec/plot.ts:42


optional aspectRatio?: number

Defined in: spec/plot.ts:53

Preferred width-to-height ratio. A hint, never a size.


optional coord?: CoordSpec

Defined in: spec/plot.ts:38

Default { kind: "cartesian" }.


optional description?: string

Defined in: spec/plot.ts:51

Prose describing what the chart shows.

Alt text for SVG and HTML, a screen-reader string, and the sentence a renderer emits when it declines the chart entirely — which is what makes declining acceptable rather than silent.


encoding: Partial<Record<Channel, EncodingSpec>>

Defined in: spec/plot.ts:36


optional fallback?: readonly PlotSpec[]

Defined in: spec/plot.ts:61

Specs to try, in order, when a renderer cannot draw this one.

A pie falls back to a normalized stacked bar, a scatter to a binned heatmap. When the list is exhausted the universal fallback applies: render the underlying frame as a table.


optional interpolate?: Interpolation

Defined in: spec/plot.ts:41


mark: Mark

Defined in: spec/plot.ts:35


optional title?: string

Defined in: spec/plot.ts:43


optional transform?: readonly TransformSpec[]

Defined in: spec/plot.ts:40

Applied in order, before the encoding is resolved.