pivotick - v2.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.

    • Adds nodes to the current selection, leaving what is already selected in place. Already-selected nodes are ignored.

      Nodes only: the interaction layer has no additive setter for edges, which can only be selected as a whole set via selectElements.

      Parameters

      • nodes: Node[]

        The Nodes to add.

      Returns void

    • Take the forecast down.

      Returns void

    • Remove any highligh class from any nodes or edges

      Returns void

    • Closes the data dock.

      Returns void

    • Deselect all

      Returns void

    • Destroy all UI components.

      Returns void

    • Repaint after an edge-layer change. Deliberately not onChange: layers don't touch the link force (see Simulation.getActiveEdges), so restarting the simulation would move the graph for no reason.

      Returns void

    • Pick a set of elements out of the graph: they keep the look they already have while everything else on the canvas dims, until clearEmphasis. This is how hovering a legend entry reads its category off the canvas.

      Where highlightElement points at one element, this describes a group. Elements that aren't drawn right now are skipped, and an empty set dims nothing.

      Parameters

      • elements: (Node | Edge)[]

        The Nodes and Edges to emphasise.

      Returns void

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

      Parameters

      • element: Node | Edge | Note

        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 all visible 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 all visible nodes in the graph. Recursively adding visible children

      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.

    • Parameters

      • id: string

      Returns Note | undefined

    • Add a highligh class to the given node or edge

      Parameters

      • element: Node | Edge

        The Node or Edge to highligh.

      Returns void

    • Trigger the next render update of the graph.

      Returns void

    • Trigger the next render update of the graph for the passed subjects.

      Parameters

      Returns void

    • Parameters

      • note: Note

      Returns void

    • Parameters

      • note: Note

      Returns void

    • Parameters

      • note: Note

      Returns void

    • Opens the data dock — the graph's rows as a sortable, selectable grid split off the bottom of the canvas. full mode only, and only when UI.table allows it; a no-op otherwise.

      The dock can hold panes other than the table now, so this also brings the table's pane to the front: the call is named for the table and should show you one. Reach for UIManager.dock or activateDockTab() to drive the region without that.

      Returns void

    • Remove everything a source vouches for. An element several sources vouch for survives, one claim lighter — the same uniform rule pivot undo follows, and the only way anything a pivot brought is removed.

      Parameters

      • source: string

        A pivot id, or 'seed' for data that was never pivoted.

      Returns { edges: Edge[]; nodes: Node[] }

      What was actually removed.

    • 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 nodes from the current selection, leaving the rest of it in place. Nodes only, on the same terms as addToSelection.

      Parameters

      • nodes: Node[]

        The Nodes to remove.

      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

    • Selects several nodes, or several edges, replacing the current selection — the plural selectElement, resolving each element's rendered handle for you.

      Nodes and edges cannot be selected together (the interaction layer clears one kind when the other is set), so a mixed array selects the nodes and warns.

      Parameters

      • elements: (Node | Edge)[]

        The Nodes or Edges to select. An empty array clears the selection.

      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.

      • notes: Note[] = []

      Returns void

    • Replace the canvas legend at runtime — the imperative twin of UI.legend. A graph that started without one gets it built on the spot; false empties the legend and drops its filter, and true / undefined fall back to deriving one from render.nodeTypeAccessor. Pass a LegendGroupOptions to key the graph on several dimensions at once.

      Parameters

      Returns void

    • Returns whether anything moved, so an edge-only filter change can repaint itself. notify is off for the query engine's first pass, which runs before anything is drawn — the constructor's own simulation.update() / renderer.init() follow it.

      Parameters

      • nodes: Node[]
      • notify: boolean = true

      Returns boolean

    • Paint what an action would do, and change nothing else: the elements it would take away drain in place, the ones it would hide with them, and whatever it would bring back is outlined where it would land.

      Where emphasiseElements reads a set out of the canvas by receding the rest, a forecast answers "what happens if I click" — so the graph has to keep reading normally around the few elements that would change. graph.history.preview(...) returns one ready-made.

      Parameters

      Returns void

    • Opens the data dock if it is closed, closes it if it is open.

      Returns void

    • Remove a highligh class to the given node or edge

      Parameters

      • element: Node | Edge

        The Node or Edge to select.

      Returns void

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

      An id the graph already holds is updated in place: what the element is — its data, style and weight — becomes what you handed over, while the object itself keeps its identity. It has to work that way. Its edges, the simulation and the DOM binding all hold that object, and so does everything it has learned since it was built: which sources vouch for it, where it sits, whether it is pinned. A position on the incoming element still wins, so updateData can move something as well as refresh it. Unknown ids are added.

      A container's children are not restructured here — pass the container through removeNode and addNode to change what it holds.

      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

      • triggerChangeEvent: boolean = true

      Returns void

    Properties

    editing: GraphEditingManager
    history: GraphHistory

    What the canvas holds and shows, and how it came to: every ingest, deletion, durable hide and hand-drawn element, contiguously reversible. Bounded and session-scoped — it does not survive a reload.

    noteManager: NoteManager
    notifier: Notifier
    pivots: PivotManager

    The pivot runtime: register enrichments, run them, triage what they return, and undo a whole run. Lives on Graph rather than the UI because pivots produce data — and because it has to exist before the UI is built.

    queryEngine: GraphQueryEngine
    renderer: GraphRenderer
    simulation: Simulation