MAIDR JavaScript API
    Preparing search index...

    Class Figure

    Represents a figure containing one or more subplots

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    observers: Observer<FigureState>[]
    isWarning: boolean
    isComputingStateAt: boolean

    True while AbstractTrace.getStateAt computes state at a temporarily moved cursor. Enforces (structurally, not just by documentation) that state getters never notify observers.

    id: string
    movable: Movable
    title: string
    subtitle: string
    caption: string
    xLabel: string
    yLabel: string
    subplots: Subplot[][]
    size: number

    Accessors

    • get isInitialEntry(): boolean

      Returns boolean

    • set isInitialEntry(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get row(): number

      Returns number

    • set row(value: number): void

      Parameters

      • value: number

      Returns void

    • get col(): number

      Returns number

    • set col(value: number): void

      Parameters

      • value: number

      Returns void

    • get activeSubplot(): Subplot

      Gets the currently active subplot based on row and column position

      Returns Subplot

      The active subplot

    • get state(): FigureState

      Gets the current state of the figure including active subplot

      Returns FigureState

      The complete figure state

    Methods

    • Runs action with this element's observers muted.

      A cursor move normally is the announcement -- moveToIndex notifies, and everything downstream of it speaks, brailles and highlights. That is wrong for a move the reader did not make and is not waiting to hear: the description dialog's layer tabs relocate the reader in the chart while the modal is open, and the trace's announcement would land in the same live region the dialog is using, so one of the two is dropped. The caller announces afterwards, once, when the reader is back on the chart.

      Nesting is safe and the flag is restored on every path, including a throw, because a flag left raised would silence the chart for good.

      Parameters

      • action: () => void

        The moves to make in silence

      Returns void

    • Gets safe row and column indices to prevent accessing undefined values

      Returns { row: number; col: number }

      Object with safe row and column indices

    • Base implementation of navigation in HIGHER and LOWER modes of ROTOR, default is no-op Needs to be implemented in Line, Bar, Heatmap, Candlestick

      Parameters

      • _direction: "left" | "right" | "up" | "down"
      • _type: "lower" | "higher"

      Returns boolean

    • Parameters

      • a: number

        Utility function to compare point values for rotor functionality

      • b: number
      • type: "lower" | "higher"

      Returns boolean

      boolean value

    • Rotor compare search along one row of numeric values.

      Steps from the current column in the given direction and moves to the first value that satisfies the comparison; reports the rotor boundary when nothing further qualifies. For the traces whose values are a plain numeric grid indexed [row][col]; a trace with a richer layout (the bar's orientation-normalised rows, the candlestick's segments) keeps its own.

      Parameters

      • rowValues: readonly number[]

        The values of the row being searched

      • direction: "left" | "right"

        Which way to search

      • type: "lower" | "higher"

        Whether a lower or a higher value is sought

      Returns boolean

      True when a matching value was found and moved to

    • Moves up in rotor mode, optionally filtering by lower or higher values.

      Parameters

      • Optional_mode: "lower" | "higher"

        Optional mode for filtering (lower or higher)

      Returns boolean

      Error always - subclasses must override this method

    • Moves down in rotor mode, optionally filtering by lower or higher values.

      Parameters

      • Optional_mode: "lower" | "higher"

        Optional mode for filtering (lower or higher)

      Returns boolean

      Error always - subclasses must override this method

    • Moves left in rotor mode, optionally filtering by lower or higher values.

      Parameters

      • Optional_mode: "lower" | "higher"

        Optional mode for filtering (lower or higher)

      Returns boolean

      Error always - subclasses must override this method

    • Moves right in rotor mode, optionally filtering by lower or higher values.

      Parameters

      • Optional_mode: "lower" | "higher"

        Optional mode for filtering (lower or higher)

      Returns boolean

      Error always - subclasses must override this method

    • Returns true if this trace supports compare (lower/higher value) navigation. Override to false for trace types that don't use compare modes (e.g., scatter, which is all we currently have).

      Returns boolean

    • Returns the display name for the default data navigation mode. Override to provide a trace-specific name (e.g., "ROW AND COLUMN NAVIGATION" for scatter).

      Returns string

    • Moves the active point to the (x, y) pointer location and returns directional guidance toward the nearest data geometry.

      Combines navigation and guidance into a single call so traces compute findNearestPoint only once per pointer event. Default returns null for non-trace contexts.

      Parameters

      • _x: number

        Screen-space x position of the pointer/finger

      • _y: number

        Screen-space y position of the pointer/finger

      Returns PointerGuidanceState | null

      Guidance state, or null when unavailable

    • Applies pre-computed visual layout data to this figure and its subplots.

      Must be called once after construction (and before the figure is used) with the result of resolveSubplotLayout().

      Parameters

      • layout: SubplotLayout

        The pre-computed layout from the utility function.

      Returns void

    • Builds at-a-glance summaries of every subplot in the figure, ordered by visual position (top-left first). Returns an empty array for single-panel figures since there is nothing extra to surface.

      Returns SubplotSummary[]