WebCola
Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

forceCenter

  • forceCenter<NodeDatum>(x?: number, y?: number): ForceCenter<NodeDatum>
  • Create a new centering force with the specified x- and y- coordinates. If x and y are not specified, they default to [0,0].

    The centering force translates nodes uniformly so that the mean position of all nodes (the center of mass if all nodes have equal weight) is at the given position [x,y]. This force modifies the positions of nodes on each application; it does not modify velocities, as doing so would typically cause the nodes to overshoot and oscillate around the desired center. This force helps keeps nodes in the center of the viewport, and unlike the positioning force, it does not distort their relative positions.

    The generic refers to the type of data for a node.

    Type parameters

    Parameters

    • Optional x: number

      An optional x-coordinate for the centering position, defaults to 0.

    • Optional y: number

      An optional y-coordinate for the centering position, defaults to 0.

    Returns ForceCenter<NodeDatum>

forceCollide

  • forceCollide<NodeDatum>(): ForceCollide<NodeDatum>
  • forceCollide<NodeDatum>(radius: number): ForceCollide<NodeDatum>
  • forceCollide<NodeDatum>(radius: function): ForceCollide<NodeDatum>
  • Creates a new circle collision force with the default radius one for all nodes.

    The collision force treats nodes as circles with a given radius, rather than points, and prevents nodes from overlapping. More formally, two nodes a and b are separated so that the distance between a and b is at least radius(a) + radius(b). To reduce jitter, this is by default a “soft” constraint with a configurable strength and iteration count.

    The generic refers to the type of data for a node.

    Type parameters

    Returns ForceCollide<NodeDatum>

  • Create a new circle collision force with the specified constant radius for all nodes.

    The collision force treats nodes as circles with a given radius, rather than points, and prevents nodes from overlapping. More formally, two nodes a and b are separated so that the distance between a and b is at least radius(a) + radius(b). To reduce jitter, this is by default a “soft” constraint with a configurable strength and iteration count.

    The generic refers to the type of data for a node.

    Type parameters

    Parameters

    • radius: number

      A constant radius for each node.

    Returns ForceCollide<NodeDatum>

  • Creates a new circle collision force with the specified radius accessor function.

    The collision force treats nodes as circles with a given radius, rather than points, and prevents nodes from overlapping. More formally, two nodes a and b are separated so that the distance between a and b is at least radius(a) + radius(b). To reduce jitter, this is by default a “soft” constraint with a configurable strength and iteration count.

    The radius accessor is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes. The resulting number is then stored internally, such that the radius of each node is only recomputed when the force is initialized or when this method is called with a new radius, and not on every application of the force.

    Type parameters

    Parameters

    • radius: function

      A radius accessor function which is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes. The function returns a radius.

        • (node: NodeDatum, i: number, nodes: NodeDatum[]): number
        • Parameters

          • node: NodeDatum
          • i: number
          • nodes: NodeDatum[]

          Returns number

    Returns ForceCollide<NodeDatum>

forceLink

  • forceLink<NodeDatum, LinksDatum>(): ForceLink<NodeDatum, LinksDatum>
  • forceLink<NodeDatum, LinksDatum>(links: LinksDatum[]): ForceLink<NodeDatum, LinksDatum>
  • Creates a new link force with the defaulting links to an empty array.

    The link force pushes linked nodes together or apart according to the desired link distance. The strength of the force is proportional to the difference between the linked nodes’ distance and the target distance, similar to a spring force.

    The first generic refers to the type of data for a node. The second generic refers to the type of data for a link.

    Type parameters

    Returns ForceLink<NodeDatum, LinksDatum>

  • Creates a new link force with the specified links array.

    The link force pushes linked nodes together or apart according to the desired link distance. The strength of the force is proportional to the difference between the linked nodes’ distance and the target distance, similar to a spring force.

    The first generic refers to the type of data for a node. The second generic refers to the type of data for a link.

    Type parameters

    Parameters

    • links: LinksDatum[]

      An array of link data.

    Returns ForceLink<NodeDatum, LinksDatum>

forceManyBody

  • Creates a new many-body force with the default parameters.

    The many-body (or n-body) force applies mutually amongst all nodes. It can be used to simulate gravity (attraction) if the strength is positive, or electrostatic charge (repulsion) if the strength is negative. This implementation uses quadtrees and the Barnes–Hut approximation to greatly improve performance; the accuracy can be customized using the theta parameter.

    Unlike links, which only affect two linked nodes, the charge force is global: every node affects every other node, even if they are on disconnected subgraphs.

    The generic refers to the type of data for a node.

    Type parameters

    Returns ForceManyBody<NodeDatum>

forceSimulation

  • forceSimulation<NodeDatum>(nodesData?: NodeDatum[]): Simulation<NodeDatum, undefined>
  • forceSimulation<NodeDatum, LinkDatum>(nodesData?: NodeDatum[]): Simulation<NodeDatum, LinkDatum>
  • Create a new simulation with the specified array of nodes and no forces. If nodes is not specified, it defaults to the empty array. The simulator starts automatically; use simulation.on to listen for tick events as the simulation runs. If you wish to run the simulation manually instead, call simulation.stop, and then call simulation.tick as desired.

    Use this signature, when creating a simulation WITHOUT link force(s).

    The generic refers to the type of the data for a node.

    Type parameters

    Parameters

    • Optional nodesData: NodeDatum[]

      Optional array of nodes data, defaults to empty array.

    Returns Simulation<NodeDatum, undefined>

  • Create a new simulation with the specified array of nodes and no forces. If nodes is not specified, it defaults to the empty array. The simulator starts automatically; use simulation.on to listen for tick events as the simulation runs. If you wish to run the simulation manually instead, call simulation.stop, and then call simulation.tick as desired.

    Use this signature, when creating a simulation WITH link force(s).

    The first generic refers to the type of data for a node. The second generic refers to the type of data for a link.

    Type parameters

    Parameters

    • Optional nodesData: NodeDatum[]

      Optional array of nodes data, defaults to empty array.

    Returns Simulation<NodeDatum, LinkDatum>

forceX

  • forceX<NodeDatum>(): ForceX<NodeDatum>
  • forceX<NodeDatum>(x: number): ForceX<NodeDatum>
  • forceX<NodeDatum>(x: function): ForceX<NodeDatum>
  • Create a new positioning force along the x-axis towards the given position x which is defaulted to a constant 0 for all nodes.

    The x-positioning force pushes nodes towards a desired position along the given dimension with a configurable strength. The strength of the force is proportional to the one-dimensional distance between the node’s position and the target position. While this force can be used to position individual nodes, it is intended primarily for global forces that apply to all (or most) nodes.

    The generic refers to the type of data for a node.

    Type parameters

    Returns ForceX<NodeDatum>

  • Create a new positioning force along the x-axis towards the given position x which is constant for all nodes.

    The x-positioning force pushes nodes towards a desired position along the given dimension with a configurable strength. The strength of the force is proportional to the one-dimensional distance between the node’s position and the target position. While this force can be used to position individual nodes, it is intended primarily for global forces that apply to all (or most) nodes.

    The generic refers to the type of data for a node.

    Type parameters

    Parameters

    • x: number

      Constant x-coordinate to be used for all nodes.

    Returns ForceX<NodeDatum>

  • Create a new positioning force along the x-axis towards the position x given by evaluating the specified x-coordinate accessor for each node.

    The x-positioning force pushes nodes towards a desired position along the given dimension with a configurable strength. The strength of the force is proportional to the one-dimensional distance between the node’s position and the target position. While this force can be used to position individual nodes, it is intended primarily for global forces that apply to all (or most) nodes.

    The generic refers to the type of data for a node.

    Type parameters

    Parameters

    • x: function

      A x-coordinate accessor function which is invoked for each node in the simulation, being passed the node and its zero-based index. The function returns the x-coordinate.

        • (d: NodeDatum, i: number, data: NodeDatum[]): number
        • Parameters

          • d: NodeDatum
          • i: number
          • data: NodeDatum[]

          Returns number

    Returns ForceX<NodeDatum>

forceY

  • forceY<NodeDatum>(): ForceY<NodeDatum>
  • forceY<NodeDatum>(y: number): ForceY<NodeDatum>
  • forceY<NodeDatum>(y: function): ForceY<NodeDatum>
  • Create a new positioning force along the y-axis towards the given position y which is defaulted to a constant 0 for all nodes.

    The y-positioning force pushes nodes towards a desired position along the given dimension with a configurable strength. The strength of the force is proportional to the one-dimensional distance between the node’s position and the target position. While this force can be used to position individual nodes, it is intended primarily for global forces that apply to all (or most) nodes.

    The generic refers to the type of data for a node.

    Type parameters

    Returns ForceY<NodeDatum>

  • Create a new positioning force along the y-axis towards the given position y which is constant for all nodes.

    The y-positioning force pushes nodes towards a desired position along the given dimension with a configurable strength. The strength of the force is proportional to the one-dimensional distance between the node’s position and the target position. While this force can be used to position individual nodes, it is intended primarily for global forces that apply to all (or most) nodes.

    The generic refers to the type of data for a node.

    Type parameters

    Parameters

    • y: number

      Constant y-coordinate to be used for all nodes.

    Returns ForceY<NodeDatum>

  • Create a new positioning force along the y-axis towards the position y given by evaluating the specified y-coordinate accessor for each node.

    The y-positioning force pushes nodes towards a desired position along the given dimension with a configurable strength. The strength of the force is proportional to the one-dimensional distance between the node’s position and the target position. While this force can be used to position individual nodes, it is intended primarily for global forces that apply to all (or most) nodes.

    The generic refers to the type of data for a node.

    Type parameters

    Parameters

    • y: function

      A y-coordinate accessor function which is invoked for each node in the simulation, being passed the node and its zero-based index. The function returns the y-coordinate.

        • (d: NodeDatum, i: number, data: NodeDatum[]): number
        • Parameters

          • d: NodeDatum
          • i: number
          • data: NodeDatum[]

          Returns number

    Returns ForceY<NodeDatum>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc