pivotick - v0.0.1
    Preparing search index...

    Class Pivotick

    Index

    Constructors

    • Initializes a graph inside the specified container using the provided data and options.

      Parameters

      • container: HTMLElement

        The HTMLElement that will serve as the main container for the graph.

      • Optionaldata: RelaxedGraphData

        The graph data, including nodes and edges, to render.

      • Optionaloptions: Partial<GraphOptions.GraphOptions>

        Optional configuration for the graph's behavior, UI, styling, simulation, etc.

      Returns Pivotick

    Methods

    • Adds an edge to the graph.

      Both the source (from) and target (to) nodes must already exist in the graph. Throws an error if an edge with the same ID already exists.

      Parameters

      Returns Edge

      Error if the edge ID already exists or if either node does not exist. Triggers onChange after the edge is successfully added.

    • Adds a node to the graph.

      Parameters

      Returns Node

      Error if a node with the same id already exists. Triggers onChange after the node is successfully added.

    • Destroy all UI components.

      Returns void

    • Brings the specified node or edge into focus within the graph view.

      Parameters

      • element: Node | Edge

        The Node or Edge to focus.

      Returns void

    • The ID of the app

      Returns string

    • Retrieves all nodes directly connected from the given node.

      Returns cloned nodes to prevent external modifications.

      Parameters

      • node: string | Node

        The node or node ID to find connections from.

      Returns Node[]

      An array of Node objects directly connected from the given node.

    • Retrieves an edge from the graph by its ID.

      Returns a deep clone of the edge to prevent external mutations.

      Parameters

      • id: string

        The ID of the edge.

      Returns Edge | undefined

      A cloned Edge if found, otherwise undefined.

    • Returns the number of edges currently in the graph.

      Returns number

      The total edge count.

    • Retrieves all edges in the graph.

      Returns clones of the edges to prevent external modifications.

      Returns Edge[]

      An array of cloned Edge objects.

    • Finds all edges originating from a given node.

      Returns cloned edges to prevent external modifications.

      Parameters

      • node: string | Node

        The node or node ID to find outgoing edges from.

      Returns Edge[]

      An array of Edge objects whose from node matches the query.

    • Finds all edges pointing to a given node.

      Returns cloned edges to prevent external modifications.

      Parameters

      • node: string | Node

        The node or node ID to find incoming edges to.

      Returns Edge[]

      An array of Edge objects whose to node matches the query.

    • Retrieves an edge from the graph by its ID.

      Returns the actual edge instance, allowing direct modifications.

      Warning: Directly modifying edges using this method may lead to unexpected behavior. It is generally safer to use getEdge which returns a cloned instance.

      Parameters

      • id: string

        The ID of the edge.

      Returns Edge | undefined

      The Edge if found, otherwise undefined.

    • Retrieves all edges in the graph.

      Returns the actual edge instances, allowing direct modifications.

      Returns Edge[]

      An array of Edge objects.

      ⚠️ Warning: Modifying edges directly may lead to unexpected behavior. Use getEdges instead to work with safe clones.

    • Retrieves a node from the graph by its ID.

      Returns the actual node instance, allowing direct modifications.

      Warning: Directly modifying nodes using this method may lead to unexpected behavior. It is generally safer to use getNode which returns a cloned instance.

      Parameters

      • id: string | Node

        The ID of the node or a Node object.

      Returns Node | undefined

      The Node if found, otherwise undefined.

    • Retrieves all nodes in the graph.

      Returns the actual node instances, allowing direct modifications.

      Returns Node[]

      An array of Node objects.

      ⚠️ Warning: Modifying nodes directly may lead to unexpected behavior. It is generally safer to use getNodes, which returns cloned instances.

    • Retrieves a node from the graph by its ID.

      Returns a deep clone of the node to prevent external mutations.

      Parameters

      • id: string | Node

        The ID of the node or a Node object.

      Returns Node | undefined

      A cloned Node if found, otherwise undefined.

    • Returns the number of nodes currently in the graph.

      Returns number

      The total node count.

    • Retrieves all nodes in the graph.

      Returns clones of the nodes to prevent external modifications.

      Returns Node[]

      An array of cloned Node objects.

    • Trigger the next render update of the graph.

      Returns void

    • Removes an edge from the graph by its ID.

      Parameters

      • id: string

        The ID of the edge to remove. Triggers onChange after the edge is removed.

      Returns void

    • Removes a node from the graph by its ID.

      Also removes any edges connected to the node.

      Parameters

      • id: string

        The ID of the node to remove. Triggers onChange after the node and its edges are removed.

      Returns void

    • Selects a given node or edge in the graph.

      Parameters

      • element: Node | Edge

        The Node or Edge to select.

      Returns void

    • Replaces all current nodes and edges in the graph with the provided data. Clears existing nodes and edges before setting the new ones. Triggers the onChange callback after the update.

      Parameters

      • nodes: Node[] = []

        Array of nodes to set. Defaults to an empty array.

      • edges: Edge[] = []

        Array of edges to set. Defaults to an empty array.

      Returns void

    • Updates the graph with new nodes and/or edges.

      Existing nodes or edges with matching IDs are replaced; new ones are added. Triggers the onChange callback if any updates were applied.

      Parameters

      • OptionalnewNodes: Node[]

        Optional array of nodes to update or add.

      • OptionalnewEdges: Edge[]

        Optional array of edges to update or add. Triggers onChange

      Returns void

    Properties

    notifier: Notifier
    ready: Promise<void>
    renderer: GraphRenderer
    simulation: Simulation