MAIDR JavaScript API
    Preparing search index...

    Interface ChartJsDataset

    A single dataset in a Chart.js chart.

    interface ChartJsDataset {
        label?: string;
        data: ChartJsDataValue[];
        type?: string;
        stack?: string;
        xAxisID?: string;
        yAxisID?: string;
        backgroundColor?: string | string[];
        borderColor?: string | string[];
        showLine?: boolean;
        stepped?: boolean | "after" | "before" | "middle";
        fill?:
            | string
            | number
            | boolean
            | { target?: string
            | number
            | boolean; value?: number };
        maidr?: MaidrTraceDeclaration;
        tree?: unknown;
        groups?: string[];
        key?: string;
        edges?: ChartJsGraphEdge[];
        labels?: Record<string, string>;
    }
    Index

    Properties

    label?: string
    type?: string
    stack?: string
    xAxisID?: string

    Id of the x scale this dataset is plotted against (defaults to 'x').

    yAxisID?: string

    Id of the y scale this dataset is plotted against (defaults to 'y').

    backgroundColor?: string | string[]
    borderColor?: string | string[]
    showLine?: boolean

    Whether a line dataset joins its points. false draws the markers alone, which is Chart.js's own way of writing a dot plot.

    stepped?: boolean | "after" | "before" | "middle"

    Step interpolation for a line dataset. 'before' (and the legacy true) hold the current value until the next x and jump there, 'after' jumps at the current x and holds the new value across, 'middle' jumps midway. false or absent draws an ordinary interpolated line.

    fill?:
        | string
        | number
        | boolean
        | { target?: string
        | number
        | boolean; value?: number }

    Whether a line dataset is filled to a boundary, making it an area band.

    Chart.js accepts a boundary name ('origin', 'start', 'end'), a dataset index to fill to (absolute 2, or relative '+1' / '-1'), the bare true for the origin, false for no fill, or an object — either { target } naming any of the above, or { value } filling to a constant on the value axis. Every one of those except false draws a band.

    What this dataset means, when the drawing cannot say.

    Chart.js has no reserved slot for third-party metadata, but it passes dataset properties it does not know through untouched — the same mechanism a survival curve's censored datum rides on (ChartJsPointValue) — so the co-located maidr block is written straight onto the dataset:

    datasets: [{
    label: 'chr1',
    data: [{ x: 1e6, y: 8.2, snp: 'rs1234' }],
    maidr: { type: 'manhattan', label: 'snp', significance: 7.3 },
    }]

    It wins over plugins.maidr.traceType, which stays the chart-wide shorthand for a figure drawn as one dataset. A block whose type names nothing, or whose keys the declared type does not accept, is reported and the chart is read as if it carried none.

    tree?: unknown

    The chartjs-chart-treemap source: an array of numbers, an array of rows, or an object. After chart.update() the plugin has replaced data with one ChartJsTreemapValue per drawn rectangle, so this is the caller's input rather than what is read.

    groups?: string[]

    The fields the treemap groups by, outermost first — e.g. ['continent', 'country']. Absent for a flat tree, which draws one unnamed rectangle per entry.

    key?: string

    Which field of a row carries the value the rectangles are sized by.

    The links of a chartjs-chart-graph dataset, when its author declared them rather than leaving the plugin to derive them from parent.

    labels?: Record<string, string>

    chartjs-chart-sankey's display names, keyed by node key — e.g. { a: 'Apple' }. A key with no entry is announced as itself.