Create Constraint and Connection

These operations specify spatial constraints between elements or connect related marks.

msc.affix(elem, base, channel, params)

Affixes an element to a base element along a channel.

If both elem and base have been joined with data (i.e., each has multiple peers), they must have the same number of peers so that each elem peer can be affixed to a corresponding base peer.

  • elem: Mark
  • base: Mark
  • channel: "x", "y", "angle", or "radialDistance"
  • params (Object, optional):
    • attribute: data attribute used to match peers when needed
    • baseAnchor: anchor on the base element
    • elementAnchor: anchor on the affixed element
    • offset: distance between the two anchors
  • Return type: void

msc.align(elems, channel, anchor)

Aligns multiple elements so they share the same position for a channel and anchor.

  • elems (Array): elements to align
  • channel: usually "x" or "y"
  • anchor: anchor used for alignment
  • Return type: void

msc.connect(nodeMarks, linkMarks)

Connects node marks and link marks so each link mark references its source and target node marks.

  • nodeMarks (Array): node marks created from network or tree node data
  • linkMarks (Array): link marks created from network or tree edge data
  • Return type: void