MAIDR Documentation - v4.4.0
    Preparing search index...

    A scale descriptor as returned by plot.scale(name).

    Plot exposes a plain object rather than a d3 scale: the configuration fields (type, domain, range, and — for band scales — bandwidth and step) plus apply, and, when the scale is invertible, invert. Ordinal and band scales carry no invert, which is why valueAtPixel maps a pixel back to a category by walking the domain instead.

    The descriptor deliberately has no label: Plot keeps the axis label in the DOM (g[aria-label="x-axis label"]), and readAxisLabel reads it from there.

    interface PlotScale {
        type: string;
        domain: unknown[];
        range?: unknown[];
        bandwidth?: number;
        step?: number;
        apply?: (value: unknown) => unknown;
        invert?: (value: unknown) => unknown;
    }
    Index

    Properties

    type: string

    Scale kind, e.g. 'linear', 'log', 'utc', 'band', 'point', 'ordinal'.

    domain: unknown[]

    Input domain. Categories for band/ordinal scales, endpoints for continuous ones.

    range?: unknown[]

    Output range in pixels (or colors, for a color scale).

    bandwidth?: number

    Width of one band, for band scales only.

    step?: number

    Distance between band starts, for band scales only.

    apply?: (value: unknown) => unknown

    Maps a domain value to its output value.

    invert?: (value: unknown) => unknown

    Maps an output value back to the domain. Absent on band/ordinal scales.