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

    Class SvgAbstract

    Abstract utility class for SVG element manipulation, conversion, and highlighting operations.

    Index

    Methods

    • Converts an SVG element to a Base64-encoded JPEG data URL.

      Parameters

      • svg: HTMLElement

        The SVG element to convert

      Returns Promise<string>

      A promise resolving to the Base64 data URL, or empty string on error

    • Selects all SVG elements matching a query and optionally clones them.

      Type Parameters

      • T extends SVGElement

        The type of SVG element to select

      Parameters

      • query: string

        CSS selector string to query elements

      • shouldClone: boolean = true

        Whether to clone elements and insert them as hidden copies (default: true)

      Returns T[]

      Array of selected (or cloned) SVG elements

    • Selects a single SVG element matching a query and optionally clones it.

      Type Parameters

      • T extends SVGElement

        The type of SVG element to select

      Parameters

      • query: string

        CSS selector string to query the element

      • shouldClone: boolean = true

        Whether to clone the element and insert it as a hidden copy (default: true)

      Returns T

      The selected (or cloned) SVG element

    • Creates an empty, hidden, transparent SVG element of the specified type.

      Parameters

      • type: string = 'rect'

        The SVG element type to create (default: 'rect')

      Returns SVGElement

      The newly created SVG element

    • Creates a circle element styled to match the parent element's stroke or fill.

      Parameters

      • cx: string | number

        The x-coordinate of the circle center

      • cy: string | number

        The y-coordinate of the circle center

      • parent: SVGElement

        The parent SVG element to inherit styling from

      Returns SVGElement

      The newly created circle element

    • Creates a line element along a specified edge of an SVG element's bounding box.

      Parameters

      • box: SVGElement

        The SVG element to create a line along

      • edge: Edge

        The edge position ('top', 'bottom', 'left', or 'right')

      Returns SVGElement

      The newly created line element

    • Creates a highlighted clone of an SVG element with enhanced visibility.

      Parameters

      • element: SVGElement

        The SVG element to highlight

      • fallbackColor: string

        Color to use if original color cannot be determined

      Returns SVGElement

      The highlighted clone element

    • Calculates a contrasting color (black or white) based on the element's fill color.

      Parameters

      • element: SVGElement

        The SVG element to analyze

      Returns string

      '#000' for light backgrounds, '#fff' for dark backgrounds

    • Applies CSS outline styling to highlight a subplot element.

      Parameters

      • element: SVGElement

        The SVG element to highlight

      • color: string

        The color for the outline

      Returns void

    • Removes CSS outline highlighting from a subplot element.

      Parameters

      • element: SVGElement

        The SVG element to remove highlighting from

      Returns void

    • Applies SVG stroke highlighting to a subplot with adaptive color based on background.

      Parameters

      • group: SVGElement

        The SVG group element to highlight

      • fallbackColor: string

        Color to use if background color cannot be determined

      • OptionalfigureBgElement: SVGElement

        Optional background element to inherit color from

      Returns void

    • Removes SVG stroke highlighting from a subplot element.

      Parameters

      • group: SVGElement

        The SVG group element to remove highlighting from

      Returns void