MAIDR JavaScript API
    Preparing search index...

    Interface UPlotInstance

    The parts of a uPlot instance the adapter reads.

    interface UPlotInstance {
        root: HTMLElement;
        over: HTMLElement;
        data: UPlotAlignedData | UPlotFacetedData;
        series: readonly UPlotSeries[];
        axes: readonly UPlotAxis[];
        scales: Readonly<Record<string, UPlotScale | undefined>>;
        mode?: number;
        width?: number;
        height?: number;
        bbox?: { left: number; top: number; width: number; height: number };
        ctx?: CanvasRenderingContext2D;
        cursor?: {
            idx?: number | null;
            idxs?: readonly (number | null)[];
            left?: number;
            top?: number;
        };
        status?: number;
        valToPos: (val: number, scaleKey: string, can?: boolean) => number;
        setCursor?: (
            opts: { left: number; top: number },
            fireHook?: boolean,
        ) => void;
    }
    Index

    Properties

    root: HTMLElement

    The .uplot wrapper uPlot mounts into its target.

    over: HTMLElement

    The plotting-area overlay; positioned over the plot, in CSS pixels.

    series: readonly UPlotSeries[]
    axes: readonly UPlotAxis[]
    scales: Readonly<Record<string, UPlotScale | undefined>>
    mode?: number
    width?: number
    height?: number
    bbox?: { left: number; top: number; width: number; height: number }

    Plot area in device pixels, relative to the canvas.

    ctx?: CanvasRenderingContext2D
    cursor?: {
        idx?: number | null;
        idxs?: readonly (number | null)[];
        left?: number;
        top?: number;
    }

    Where uPlot's cursor is: idx is the nearest data index in aligned mode, idxs the nearest index per series (the only one set in faceted mode), left/top its CSS-pixel position in the plotting area.

    status?: number

    1 once uPlot has drawn for the first time (ready has fired).

    valToPos: (val: number, scaleKey: string, can?: boolean) => number

    Converts a data value to a CSS-pixel offset inside the plotting area (can = false) or a device-pixel offset on the canvas (can = true).

    setCursor?: (opts: { left: number; top: number }, fireHook?: boolean) => void