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

    Class HighlightService

    Service responsible for managing visual highlighting of SVG elements in MAIDR visualizations.

    The HighlightService provides visual feedback by creating highlight overlays on chart elements when users navigate through data points. It supports both trace-level highlighting (individual data points) and subplot-level highlighting (for multi-plot scenarios).

    • Observes state changes to update highlights
    • Supports cleanup when the service is no longer needed
    const highlightService = new HighlightService(settingsService);

    // Subscribe to state changes
    traceState.subscribe(highlightService);

    // Manual highlighting
    highlightService.highlight(svgElement);

    // Cleanup
    highlightService.dispose();

    Implements

    Index

    Constructors

    Methods

    • Disposes of the service by removing all active highlights. Should be called when the service is no longer needed to prevent memory leaks.

      Returns void

    • Observer update method called when observed state changes. Routes to appropriate handler based on state type.

      Parameters

      • state: HighlightStateUnion

        The updated state object (Settings, SubplotState, TraceState, or FigureState)

      Returns void

    • Manually highlights a single SVG element. Removes any existing highlight on the element before applying a new one.

      Parameters

      • element: SVGElement

        The SVG element to highlight

      Returns void

    • Removes the highlight from a single SVG element. Safely handles cases where the element has no active highlight.

      Parameters

      • element: SVGElement

        The SVG element to remove highlight from

      Returns void

    • Clears all active highlights from both trace elements and subplots. Use this method to reset the visual state of the visualization.

      Returns void