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

    Class BoxTrace

    Concrete implementation of a box plot trace supporting vertical and horizontal orientations. Handles boxplot sections (min, Q1, Q2, Q3, max, outliers) and rotor-based navigation.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    observers: Observer<TraceState>[]
    id: string
    type: TraceType
    title: string
    xAxis: string
    yAxis: string
    fill: string
    navigationService: NavigationService
    layer: MaidrLayer
    supportsExtrema: false

    Abstract property that subclasses must implement to indicate extrema support

    movable: Movable
    highlightValues: (SVGElement | SVGElement[])[][] | null
    highlightCenters:
        | {
            x: number;
            y: number;
            row: number;
            col: number;
            element: SVGElement;
        }[]
        | null

    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

    • get state(): TraceState

      Gets the current state of the trace including audio, braille, text, and highlight information.

      Returns TraceState

      The current TraceState

    • get values(): (number | number[])[][]

      Returns (number | number[])[][]

    Methods

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

      Returns { row: number; col: number }

      Object with safe row and column indices

    • Parameters

      • a: number

        Utility function to compare point values for rotor functionality

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

      Returns boolean

      boolean value

    • Checks if the specified coordinates are within bounds of the element.

      Parameters

      • x: number

        The x-coordinate

      • y: number

        The y-coordinate

      • element: { element: SVGElement; row: number; col: number }

        Object containing the SVG element and its position

        • element: SVGElement

          The SVG element to check bounds against

        • row: number

          The row position of the element

        • col: number

          The column position of the element

      Returns boolean

      True if the point is in bounds, false otherwise

    • Override moveOnce for violin box plots to reset to bottom point (MIN section) when switching between violins. For vertical: FORWARD/BACKWARD changes violin (col), reset to MIN section (row = 1) For horizontal: UPWARD/DOWNWARD changes violin (row), reset to MIN section (col = 1)

      Returns void

    • Moves to the next boxplot section that matches the comparison criteria.

      Parameters

      • direction: "left" | "right" | "up" | "down"

        The direction to move (left, right, up, or down)

      • type: "lower" | "higher"

        The comparison type (lower or higher)

      Returns boolean

      True if a target was found, false otherwise

    • Sets the current point based on direction and index.

      Parameters

      • direction: "left" | "right" | "up" | "down"

        The direction of movement (left, right, up, or down)

      • pointIndex: number

        The index to set

      Returns void

    • Moves upward in rotor mode within boxplot segments.

      Parameters

      • mode: "lower" | "higher"

        The comparison mode (lower or higher)

      Returns boolean

      True if the move was successful, false otherwise

    • Moves downward in rotor mode within boxplot segments.

      Parameters

      • mode: "lower" | "higher"

        The comparison mode (lower or higher)

      Returns boolean

      True if the move was successful, false otherwise

    • Moves left in rotor mode within boxplot segments.

      Parameters

      • mode: "lower" | "higher"

        The comparison mode (lower or higher)

      Returns boolean

      True if the move was successful, false otherwise

    • Moves right in rotor mode within boxplot segments.

      Parameters

      • mode: "lower" | "higher"

        The comparison mode (lower or higher)

      Returns boolean

      True if the move was successful, false otherwise

    • Maps SVG elements to their center coordinates for proximity detection.

      Returns { x: number; y: number; row: number; col: number; element: SVGElement }[] | null

      Array of center points with element references or null if no elements exist

    • Finds the nearest boxplot element at the specified coordinates.

      Parameters

      • x: number

        The x-coordinate

      • y: number

        The y-coordinate

      Returns { element: SVGElement; row: number; col: number } | null

      Object containing the element and its position, or null if not found

    • Moves to the nearest point at the specified coordinates (disabled for boxplots).

      Parameters

      • _x: number

        The x-coordinate

      • _y: number

        The y-coordinate

      Returns void

    • Override to return the violin index (numeric) for layer switching. For violin box plots (vertical): col represents violin index. For violin box plots (horizontal): row represents violin index. Only applicable for violin box plots.

      Returns XValue | null

      The violin index as a number for violin box plots. For vertical box plots, returns the column index. For horizontal box plots, returns the row index. For regular box plots, returns the parent implementation result (which may be a string or number). Returns null if the position is invalid.

    • Override moveToXValue for violin box plots to reset to bottom point (MIN section) when moving to a different violin. For vertical: sets col (violin index) and resets row to 1 (MIN section) For horizontal: sets row (violin index) and resets col to 1 (MIN section)

      Parameters

      Returns boolean

    • Get the current Y value from the box plot. This is used when switching to KDE layer to preserve the Y level. Only applicable for violin box plots.

      Returns number | null

      The current Y value from the box plot section at the current position. For outliers (arrays), returns the first value. Returns null if the position is invalid, if the value cannot be determined, or if this is not a violin box plot.

    • Move to a specific violin (X value) and find the closest box plot section with the given Y value. This is used when switching from KDE layer to preserve Y level. Only applicable for violin box plots.

      Parameters

      • xValue: XValue

        The violin index (X value) to move to. Must be a numeric index. String values are not supported.

      • yValue: number

        The Y value to find the closest matching box plot section for

      Returns boolean

      true if the move was successful (valid violin index and closest section found), false if xValue is not a number, if the violin index is out of bounds, or if this is not a violin box plot

    • Handle switching from another trace. Implements special handling for switching from violin KDE layer to preserve both violin position (X) and Y value. Only applicable for violin box plots.

      Parameters

      • previousTrace: Trace

        The trace we're switching from

      Returns boolean

      true if handled (switching from violin KDE to violin box), false otherwise