MAIDR Documentation - v3.75.0
    Preparing search index...

    Minimal subset of a Vega View that the adapter needs at runtime.

    The compiled view exposes processed datasets (post-transform / aggregate) via VegaView.data, which is the most accurate source for chart data extraction.

    VegaView.runAsync is used by the adapter to wait for the first render frame to complete, which guarantees the SVG element exists in the container before MAIDR tries to mount on it.

    interface VegaView {
        data: (name: string) => Record<string, unknown>[];
        container: () => HTMLElement | null;
        runAsync: () => Promise<VegaView>;
        scale: (name: string) => { domain: () => unknown[] } | undefined;
        getState?: (
            options?: {
                data?: (name?: string, object?: unknown) => boolean;
                signals?: (name?: string, operator?: unknown) => boolean;
                recurse?: boolean;
            },
        ) => | {
            data?: Record<string, unknown>;
            signals?: Record<string, unknown>;
        }
        | undefined;
    }
    Index

    Properties

    data: (name: string) => Record<string, unknown>[]
    container: () => HTMLElement | null
    runAsync: () => Promise<VegaView>
    scale: (name: string) => { domain: () => unknown[] } | undefined

    Look up a Vega scale by name (e.g. 'x', 'y', 'color').

    Returns undefined if the scale doesn't exist. The scale's domain() provides the rendered domain in the order Vega uses to lay out marks — used by the adapter to align data ordering with the SVG DOM order so MAIDR's index-based highlighting matches the visible chart.

    getState?: (
        options?: {
            data?: (name?: string, object?: unknown) => boolean;
            signals?: (name?: string, operator?: unknown) => boolean;
            recurse?: boolean;
        },
    ) => | { data?: Record<string, unknown>; signals?: Record<string, unknown> }
    | undefined

    Serialise the view's state. The adapter uses it for one thing only: enumerating the names of every registered dataset, so it can reach pipelines it cannot address by a name it derived.

    Two details of the real signature are easy to get wrong, and both fail silently — see getViewDatasetNames:

    • data is a predicate, not a boolean. Vega throws options.data is not a function when handed true.
    • The returned values are Vega's internal state descriptors, not rows. Use VegaView.data to read records.

    Optional because the adapter must tolerate a view that predates it or a host that stubs only part of the API.