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

      Point selector at the links — one <line> per edge — rather than at the node circles. The nodes are derived from the links, so the links are what map one-to-one onto the payload; a selector matching the circles would give the trace a node count where it expects a link count, and highlighting would be withdrawn.

      Parameters

      • svg: Element

        The SVG element containing the D3 network.

      • config: D3NetworkConfig

        Configuration specifying the selector and data accessors.

      Returns D3BinderResult

      A D3BinderResult with the MAIDR data and generated layer.

      Timing — call after the simulation has been wired up. d3.forceLink replaces each link's source and target with the resolved node objects, so the binder reads names either way; what it cannot do is run before the lines are joined. Bind right after the .data(links).join('line') chain — there is no need to wait for the simulation to settle, since no position is read.

      • MaidrD3
      • useD3Adapter
      const link = svg.selectAll('line.link').data(links).join('line');
      d3.forceSimulation(nodes).force('link', d3.forceLink(links).id(d => d.id));

      bindD3Network(svgElement, {
      selector: 'line.link',
      title: 'Collaborations',
      axes: { x: 'Person', y: 'Links' },
      });