MAIDR Documentation - v3.65.0
    Preparing search index...
    • Binds a D3.js-rendered SVG to a Maidr data structure.

      The hook reads svgRef.current inside a useEffect, which means:

      • It runs after React commits the SVG to the DOM.
      • It does not automatically detect when D3 mutates the SVG. Pass the values that drive your D3 drawing as deps so the hook re-binds when your chart changes.

      Parameters

      • svgRef: RefObject<SVGElement | null>

        Ref pointing to the SVG element containing the rendered chart.

      • spec: D3AdapterSpec

        Discriminated union of chart type + binder-specific config.

      • Optionaldeps: DependencyList

        Values that should trigger re-binding. Defaults to [] (bind once on mount). Include your chart's data here to keep MAIDR in sync with live D3 updates.

      Returns UseD3AdapterResult

      Object with maidrData (the extracted MAIDR schema, or null until the first successful bind) and error (the most recent binder error, or null on success).