MAIDR Documentation - v4.4.0
    Preparing search index...
    • Binds a D3.js dumbbell chart to MAIDR, generating the accessible data representation.

      Point selector at the connectors — one <line> per row — rather than at the dots. A dumbbell draws one segment and two dots per row, so the connectors are the elements that map one-to-one onto the data; a selector matching the dots would produce twice as many elements as rows and the trace would withdraw highlighting rather than pair them wrongly.

      Name the two ends with startLabel / endLabel. They are what the chart's legend gives a sighted reader for free: without them a chart of life expectancy in 1990 against 2020 tells the reader they are on the "start" dot, which is the one thing they already knew.

      Parameters

      • svg: Element

        The SVG element containing the D3 dumbbell chart.

      • config: D3DumbbellConfig

        Configuration specifying the selector and data accessors.

      Returns D3BinderResult

      A D3BinderResult with the MAIDR data and generated layer.

      Timing — call after D3 has rendered. Like every D3 binder, this reads each matched element's D3-bound __data__; calling it before .data().join() has run (or before the SVG is mounted) throws "No elements found for selector …" or "Property '…' not found on datum".

      • MaidrD3
      • useD3Adapter
      const result = bindD3Dumbbell(svgElement, {
      selector: 'line.connector',
      title: 'Life Expectancy, 1990 against 2020',
      orientation: Orientation.HORIZONTAL,
      axes: { x: 'Years', y: 'Country' },
      x: 'country',
      start: 'y1990',
      end: 'y2020',
      startLabel: '1990',
      endLabel: '2020',
      });