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

    NavigationService handles orientation-specific coordinate transformations and navigation logic that was previously mixed into Core Model classes.

    This service encapsulates the business logic for translating between UI coordinates (row, col) and model coordinates (pointIndex, segmentType) based on data orientation, as well as X-value navigation across trace types.

    Implements

    Index

    Constructors

    Methods

    • Handle layer switching within a subplot. Encapsulates business logic for preserving positions, invoking trace-specific switch handling, and notifying observers about layer switches.

      Parameters

      Returns Trace | null

      The newly active trace (may be the same as the previous one) or null if unavailable.

    • Compute normalized point index and segment type based on orientation

      Type Parameters

      • T extends string

      Parameters

      • row: number

        The row coordinate from UI/ViewModel

      • col: number

        The column coordinate from UI/ViewModel

      • orientation: Orientation

        The data orientation

      • sections: readonly T[]

        Array of available section names (e.g., ['open', 'high', 'low', 'close'])

      Returns { pointIndex: number; segmentType: T }

      Object containing pointIndex and segmentType

    • Compute visual coordinates for highlighting based on orientation

      Parameters

      • pointIndex: number

        The data point index

      • segmentPosition: number

        The segment position (e.g., dynamic sorted position)

      • orientation: Orientation

        The data orientation

      Returns { row: number; col: number }

      Object containing row and col for visual highlighting

    • Extract X value from points array based on current position.

      Parameters

      • points: PointWithX[] | PointWithX[][]

        Array of points (single or multi-row)

      • row: number

        The row index

      • col: number

        The column index

      Returns XValue | null

      The extracted X value or null if not found

    • Extract X value from values array based on current position.

      Parameters

      • values: ValuesArray

        2D array of values

      • row: number

        The row index

      • col: number

        The column index

      Returns XValue | null

      The extracted X value or null if not found

    • Navigate to a specific X value within the points array and invoke callback with new position.

      Parameters

      • points: PointWithX[] | PointWithX[][]

        Array of points (single or multi-row)

      • xValue: XValue

        The target X value to navigate to

      • moveToIndex: (row: number, col: number) => void

        Callback function to execute when position is found

      Returns boolean

      True if navigation was successful, false otherwise

    • Navigate to a specific X value within the values array and invoke callback with new position.

      Parameters

      • values: ValuesArray

        2D array of values

      • xValue: XValue

        The target X value to navigate to

      • moveToIndex: (row: number, col: number) => void

        Callback function to execute when position is found

      Returns boolean

      True if navigation was successful, false otherwise