Newton Graph Library

Newton Graph Library

Class

Links

Extends

Encapsulates what is needed to draw <line>s to represent the links between nodes of a network graph, namely rendering and positioning.

Styling, including colors and arrowheads are accomplished using CSS on the selectors, including

  • [data-rel="is-source"]
  • [data-rel="is-target"]
  • [data-rel="is-deep-source"]
  • [data-rel="has-no-relationship"]

Constructor

Parameters

  • options Object

    Properties

    • dom String <optional>
      window.document

      DOM reference, required for testing

    • container String <optional>

      HTML identifier used by d3.js

Source

Methods

bindGraph(graph)

Binds this view to a graph so we can react to changes and re-render and adjust the graph as necessary.

Parameters

  • graph Graph

    graph to listen to for changes

Overrides

Source

position()

Re-calculates and repositions elements using current data. This is used by the webcola layout adapter for "less noisy" network visualizations.

Overrides

Source

showArrows(node, optionsopt)

Adds directional arrows to indicate source-target relationship between nodes.

Parameters

  • node Node
  • options Object <optional>
    {}

    Properties

    • color Boolean <optional>
      true
    • showAll Boolean <optional>
      true

      If set to true, this view will draw all arrows, even if link has no relationship to node.

Source

Events

enter

An Array of entering links, i.e. links to be added per d3.js general update pattern.

Type

  • Array

Listeners of this event

exit

An Array of exiting links, i.e. links to be removed per d3.js general update pattern.

Type

  • Array

Listeners of this event

update

An Array of combined existing and new links, per d3.js general update pattern.

Type

  • Array