Skip to content

GraphNode

Unofficial

Represents a node in the graph view.

Import:

import type { GraphNode } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface GraphNode

Properties

PropertyTypeDescription
circleGraphics | nullPixiJS element for the circle, child of GraphRenderer.hanger.
colorGraphColorAttributesComputed color for the node.
fadeAlphanumberCurrent fade alpha value controlling the node's transparency during transitions.
fontDirtybooleanIndicates if the text needs to be re-rendered when the node is rendered.
forwardRecord<string, GraphLink>Record of forward links. Keys are the id of the neighbor nodes.
fxnull | numberForced x position when the node is dragged.
fynull | numberForced y position when the node is dragged.
highlightGraphics | nullColored circle added if the node is highlighted, child of GraphNode.circle.
idstringID of the node (path, tag, or name for non-existing files).
moveTextnumberDisplacement of the text, changed when the node is hovered
renderedbooleanWhether the node graphics have been rendered.
rendererGraphRendererGraphRenderer managing this node
reverseRecord<string, GraphLink>Record of backward links. Keys are the id of the neighbor nodes.
textnull | PIXITextPixiJS element for the name, child of GraphNode.circle.
typestringType of the node, can be of value "tag", "unresolved", "attachment", or an empty string for markdown nodes.
weightnumberWeight of the node depending on the number of related nodes (forwards and backward).
xnumberX-axis position of the node in the graph
ynumberY-axis position of the node in the graph

Methods

MethodReturnsDescription
clearGraphics()voidDestroy the graphics and its children, and remove them from the scene.
getDisplayText()stringGet the displayed text associated to the node.
getFillColor()GraphColorAttributesGet the current fill color.
getRelated()string[]Get the ids of connected nodes (back and forward links).
getSize()numberGet the current size of the node, after weight and node size multiplier have been applied.
getTextStyle()TextStyleGet the text style of the node.
initGraphics()voidInitialize the node, text, listeners, and add them to the scene.
onClick(e)voidMethod called when the node (circle) is clicked, trigger the context menu if it's a right click
render()voidRender the node.

Links to this page: