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

    Class PatternService

    Index

    Constructors

    Methods

    • Initialize the pattern service with a target SVG element. Ensures a element exists for pattern definitions.

      Parameters

      • svg: SVGSVGElement

        The SVG element to inject patterns into

      Returns void

    • Get or create a pattern with the specified configuration. Returns the pattern ID to use in fill="url(#id)".

      Parameters

      Returns string

      Pattern ID string for use in fill attribute

    • Apply a pattern to an SVG element. Handles both style attribute and fill attribute cases.

      Parameters

      • element: SVGElement

        The element to apply the pattern to

      • config: PatternConfig

        Pattern configuration

      Returns void

    • Remove pattern from an element and restore original fill.

      Parameters

      • element: SVGElement

        The element to remove the pattern from

      • originalFill: string

        The original fill value to restore

      Returns void

    • Get all available pattern types. Useful for cycling through patterns for different data series. Note: order determines assignment, eg the first series gets the first pattern and so on.

      Returns PatternType[]

    • Get pattern type by index (wraps around if index > number of patterns). Useful for assigning patterns to data series.

      Parameters

      • index: number

        Zero-based index

      Returns PatternType