MAIDR JavaScript API
    Preparing search index...
    • Ensures a container element has an id, generating one when missing.

      MAIDR resolves a chart's selectors inside that chart, so a bare selector like "rect.bar" does not reach another chart's marks there. Stamping the container with a stable id and prefixing emitted selectors with #<id> makes each selector name this chart's marks alone wherever it is read, without requiring users to set the id themselves.

      Idempotent: re-calling on a container that already has an id is a no-op.

      Parameters

      • container: Element

        The root container element (or any element).

      • prefix: string = 'maidr'

        Adapter-specific id prefix used when generating a new id.

      Returns string

      The container's id (existing or newly generated).