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

    Interface Trace

    Interface representing a trace with navigation and observation capabilities

    interface Trace {
        getId: () => string;
        getCurrentXValue: () => any;
        moveToXValue: (xValue: any) => boolean;
        getCurrentYValue?: () => number | null;
        moveToXAndYValue?: (xValue: any, yValue: number) => boolean;
        notifyOutOfBounds: () => void;
        resetToInitialEntry: () => void;
        notifyObserversWithState: (state: TraceState) => void;
        getAllHighlightElements: () => SVGElement[];
        getAllOriginalElements: () => SVGElement[];
        moveToPoint: (x: number, y: number) => void;
        getExtremaTargets?: () => ExtremaTarget[];
        navigateToExtrema?: (target: ExtremaTarget) => void;
        dispose: () => void;
        moveOnce: (direction: MovableDirection) => boolean;
        moveToExtreme: (direction: MovableDirection) => boolean;
        moveToIndex: (row: number, col: number) => boolean;
        isMovable: (target: MovableDirection | [number, number]) => boolean;
        get isInitialEntry(): boolean;
        set isInitialEntry(value: boolean): void;
        get isOutOfBounds(): boolean;
        set isOutOfBounds(value: boolean): void;
        get row(): number;
        set row(value: number): void;
        get col(): number;
        set col(value: number): void;
        addObserver: (observer: Observer<TraceState>) => void;
        removeObserver: (observer: Observer<TraceState>) => void;
        notifyStateUpdate: () => void;
        get state(): T;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    getId: () => string

    Gets the unique identifier for the trace

    Type Declaration

      • (): string
      • Returns string

        The trace ID

    getCurrentXValue: () => any

    Gets the current X value from the trace

    Type Declaration

      • (): any
      • Returns any

        The current X value or null if not available

    moveToXValue: (xValue: any) => boolean

    Moves the trace to the position that matches the given X value

    Type Declaration

      • (xValue: any): boolean
      • Parameters

        • xValue: any

          The X value to move to

        Returns boolean

        True if the position was found and set, false otherwise

    getCurrentYValue?: () => number | null

    Get the current Y value from the trace. Optional method implemented by traces that support Y value preservation during layer switching.

    Type Declaration

      • (): number | null
      • Returns number | null

        The current Y value or null if not available

    moveToXAndYValue?: (xValue: any, yValue: number) => boolean

    Move to a specific X value and find the closest position with the given Y value. Optional method implemented by traces that support preserving both X and Y values during layer switching.

    Type Declaration

      • (xValue: any, yValue: number): boolean
      • Parameters

        • xValue: any

          The X value to move to

        • yValue: number

          The Y value to find the closest matching position for

        Returns boolean

        true if the move was successful, false otherwise

    notifyOutOfBounds: () => void

    Notify observers that the trace is out of bounds

    resetToInitialEntry: () => void

    Resets the trace to initial entry state

    notifyObserversWithState: (state: TraceState) => void

    Notifies all observers with a specific state

    Type Declaration

      • (state: TraceState): void
      • Parameters

        • state: TraceState

          The trace state to send to observers

        Returns void

    getAllHighlightElements: () => SVGElement[]

    Get all highlight SVG elements for this trace Used by HighlightService for high contrast mode

    Type Declaration

      • (): SVGElement[]
      • Returns SVGElement[]

        Array of all SVG elements, or empty array if none

    getAllOriginalElements: () => SVGElement[]
    moveToPoint: (x: number, y: number) => void

    Move the active point within this trace to the given (x, y) viewport coordinates. Implemented by all concrete traces via AbstractPlot / AbstractTrace, and used by Context for hover / click navigation.

    Type Declaration

      • (x: number, y: number): void
      • Parameters

        • x: number

          The x-coordinate in viewport pixels to move to.

        • y: number

          The y-coordinate in viewport pixels to move to.

          Behavior:

          • Finds the nearest data point to the given coordinates
          • If no valid nearest point exists or coordinates are out of bounds, no action is taken
          • If coordinates are within bounds and position is different, triggers state update via moveToIndex
          • If already at the target position, returns without triggering state update

          Violin Plot Specific Behavior:

          • For ViolinKdeTrace: Coordinates map to (violin index, y-value within KDE curve)
          • For ViolinBoxTrace: Coordinates map to (section index, violin index) for vertical orientation, or (violin index, section index) for horizontal orientation

        Returns void

    getExtremaTargets?: () => ExtremaTarget[]

    Gets extrema targets for navigation. Optional method implemented by traces that support extrema navigation.

    Type Declaration

    navigateToExtrema?: (target: ExtremaTarget) => void

    Navigate to a specific extrema target. Optional method implemented by traces that support extrema navigation.

    Type Declaration

    dispose: () => void
    moveOnce: (direction: MovableDirection) => boolean
    moveToExtreme: (direction: MovableDirection) => boolean
    moveToIndex: (row: number, col: number) => boolean
    isMovable: (target: MovableDirection | [number, number]) => boolean
    addObserver: (observer: Observer<TraceState>) => void
    removeObserver: (observer: Observer<TraceState>) => void
    notifyStateUpdate: () => void

    Accessors

    • get isInitialEntry(): boolean

      Returns boolean

    • set isInitialEntry(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get isOutOfBounds(): boolean

      Returns boolean

    • set isOutOfBounds(value: boolean): void

      Parameters

      • value: boolean

      Returns void