拓展 / Pivotick
类: Pivotick
定义于:Graph.ts:26
构造函数
构造函数
new Pivotick(
container,data?,options?):Graph
定义于:Graph.ts:87
使用提供的数据和选项初始化指定容器内的图形。
参数
container
HTMLElement
将用作图表的主容器的 HTMLElement。
data?
要渲染的图形数据,包括节点和边。
options?
Partial<GraphOptions>
图表行为、UI、样式、模拟等的可选配置。
返回值
Graph
方法
addEdge()
addEdge(
e):Edge
定义于:Graph.ts:1000
向图形添加一条边。
源 (from) 和目标 (to) 节点必须已存在于图中。如果具有相同 ID 的边已存在,则会引发错误。
参数
e
要添加的边缘。
返回值
投掷
如果边 ID 已存在或任一节点不存在,则会出错。添加边成功后触发onChange。
addNode()
addNode(
n):Node
定义于:Graph.ts:902
向图中添加一个节点。
参数
n
返回值
投掷
如果具有相同 id 的节点已存在,则会出错。添加节点成功后触发onChange。
addNote()
addNote(
n):Note|undefined
定义于:Graph.ts:1265
向图表添加注释并绘制它。采用与 data.notes 相同的选项(Note.toJSON 返回的内容)或 Note。发出 noteAdd。
参数
n
返回值
Note | undefined
注释,或 undefined,而 UI.notes.enabled 为 false。
投掷
Error if a note with the same id already exists.
addToSelection()
addToSelection(
nodes):void
定义于:Graph.ts:1637
将节点添加到当前选择,保留已选择的内容。已选择的节点将被忽略。
仅节点:交互层没有边的附加设置器,只能通过selectElements作为一个整体进行选择。
参数
nodes
Node[]
要添加的 Node。
返回值
void
clearEmphasis()
clearEmphasis():
void
定义于:Graph.ts:1726
End the emphasis emphasiseElements started: the canvas reads normally again.
返回值
void
clearForecast()
clearForecast():
void
定义于:Graph.ts:1745
把预报调下来。
返回值
void
clearHighlightedElements()
clearHighlightedElements():
void
定义于:Graph.ts:1707
Remove any highligh class from any nodes or edges
返回值
void
closeTable()
closeTable():
void
定义于:Graph.ts:1669
关闭数据坞。
返回值
void
deselectAll()
deselectAll():
void
定义于:Graph.ts:1681
取消全选
返回值
void
destroy()
destroy():
void
定义于:Graph.ts:1444
销毁所有 UI 组件。
返回值
void
edgeVisibilityChanged()
edgeVisibilityChanged():
void
定义于:Graph.ts:1388
边缘层更改后重新绘制。故意不onChange:层不接触链接力(参见Simulation.getActiveEdges),因此重新启动模拟会无缘无故地移动图形。
返回值
void
emphasiseElements()
emphasiseElements(
elements):void
定义于:Graph.ts:1721
从图表中选择一个集合元素:它们保持已有的外观,而画布上的其他所有内容都变暗,直到clearEmphasis。这就是将鼠标悬停在图例条目上从画布上读取其类别的方式。
其中 highlightElement 指向一个元素,这描述了一个组。现在未绘制的元素将被跳过,空集不会使任何内容变暗。
参数
elements
要强调的Node和Edge。
返回值
void
focusElement()
focusElement(
element):void
定义于:Graph.ts:1583
将指定的节点或边置于图形视图中的焦点。隐藏在封闭集群或组中的节点使该集群或组成为焦点。
参数
element
Node 或 Edge 进行对焦。
返回值
void
getAppID()
getAppID():
string
定义于:Graph.ts:1456
应用程序的ID
返回值
string
getConnectedNodes()
getConnectedNodes(
node):Node[]
定义于:Graph.ts:1241
Retrieves all nodes directly connected from the given node.
Returns cloned nodes to prevent external modifications.
参数
node
要从中查找连接的节点或节点 ID。
string | Node
返回值
Node[]
An array of Node objects directly connected from the given node.
getEdge()
getEdge(
id):Edge|undefined
定义于:Graph.ts:1036
通过 ID 从图中检索边。
Returns a deep clone of the edge to prevent external mutations.
参数
id
string
边的 ID。
返回值
Edge | undefined
如果找到则为克隆的Edge,否则为undefined。
getEdgeCount()
getEdgeCount():
number
定义于:Graph.ts:1086
Returns the number of edges currently in the graph.
返回值
number
总边数。
getEdges()
getEdges():
Edge[]
定义于:Graph.ts:1168
检索图中的所有边。
Returns clones of the edges to prevent external modifications.
返回值
Edge[]
克隆的 Edge 对象的数组。
getEdgesFromNode()
getEdgesFromNode(
node):Edge[]
定义于:Graph.ts:1211
查找源自给定节点的所有边。
Returns cloned edges to prevent external modifications.
参数
node
用于查找传出边缘的节点或节点 ID。
string | Node
返回值
Edge[]
Edge 对象的数组,其 from 节点与查询匹配。
getEdgesToNode()
getEdgesToNode(
node):Edge[]
定义于:Graph.ts:1226
Finds all edges pointing to a given node.
Returns cloned edges to prevent external modifications.
参数
node
The node or node ID to find incoming edges to.
string | Node
返回值
Edge[]
An array of Edge objects whose to node matches the query.
getGraphDepth()
getGraphDepth():
number
定义于:Graph.ts:1566
返回值
number
getMutableEdge()
getMutableEdge(
id):Edge|undefined
定义于:Graph.ts:1052
通过 ID 从图中检索边。
Returns the actual edge instance, allowing direct modifications.
警告: 使用此方法直接修改边可能会导致意外行为。通常使用返回克隆实例的 getEdge 更安全。
参数
id
string
边的 ID。
返回值
Edge | undefined
The Edge if found, otherwise undefined.
getMutableEdges()
getMutableEdges():
Edge[]
定义于:Graph.ts:1184
检索图中的所有边。
返回实际的边实例,允许直接修改。
返回值
Edge[]
Edge 对象的数组。
备注
⚠️ 警告:直接修改边可能会导致意外行为。使用 getEdges 来处理安全克隆。
getMutableNode()
getMutableNode(
id):Node|undefined
定义于:Graph.ts:943
Retrieves a node from the graph by its ID.
Returns the actual node instance, allowing direct modifications.
警告: 使用此方法直接修改节点可能会导致意外行为。通常使用返回克隆实例的 getNode 更安全。
参数
id
The ID of the node or a Node object.
string | Node
返回值
Node | undefined
The Node if found, otherwise undefined.
getMutableNodes()
getMutableNodes():
Node[]
定义于:Graph.ts:1114
Retrieves all nodes in the graph.
返回实际的节点实例,允许直接修改。
返回值
Node[]
An array of Node objects.
备注
⚠️ 警告:直接修改节点可能会导致意外行为。通常使用 getNodes 更安全,它返回克隆实例。
getMutableVisibleEdges()
getMutableVisibleEdges():
Edge[]
定义于:Graph.ts:1199
Retrieves all visible edges in the graph.
返回实际的边实例,允许直接修改。
返回值
Edge[]
Edge 对象的数组。
备注
⚠️ 警告:直接修改边可能会导致意外行为。使用 getEdges 来处理安全克隆。
getMutableVisibleNodes()
getMutableVisibleNodes():
Node[]
定义于:Graph.ts:1130
Retrieves all visible nodes in the graph. Recursively adding visible children
返回实际的节点实例,允许直接修改。
返回值
Node[]
An array of Node objects.
备注
⚠️ 警告:直接修改节点可能会导致意外行为。通常使用 getNodes 更安全,它返回克隆实例。
getNode()
getNode(
id):Node|undefined
定义于:Graph.ts:927
Retrieves a node from the graph by its ID.
返回节点的深度克隆以防止外部突变。
参数
id
The ID of the node or a Node object.
string | Node
返回值
Node | undefined
如果找到则为克隆的Node,否则为undefined。
getNodeCount()
getNodeCount():
number
定义于:Graph.ts:1077
返回图中当前的节点数。
返回值
number
总节点数。
getNodes()
getNodes():
Node[]
定义于:Graph.ts:1097
Retrieves all nodes in the graph.
返回节点的克隆以防止外部修改。
返回值
Node[]
克隆的 Node 对象的数组。
getNote()
getNote(
id):Note|undefined
定义于:Graph.ts:1254
参数
id
string
返回值
Note | undefined
getNotes()
getNotes():
Note[]
定义于:Graph.ts:1250
返回值
Note[]
getOptions()
getOptions():
GraphOptions
定义于:Graph.ts:693
Returns the current configuration options of the graph.
返回值
hideNode()
hideNode(
node):void
定义于:Graph.ts:1393
参数
node
返回值
void
highlightElement()
highlightElement(
element):void
定义于:Graph.ts:1690
Add a highligh class to the given node or edge
参数
element
The Node or Edge to highligh.
返回值
void
nextTick()
nextTick():
void
定义于:Graph.ts:1430
Trigger the next render update of the graph.
返回值
void
nextTickFor()
nextTickFor(
nodes):void
定义于:Graph.ts:1437
触发已传递主题的图形的下一个渲染更新。
参数
nodes
Node[]
返回值
void
noteAdd()
noteAdd(
note):void
定义于:Graph.ts:422
参数
note
返回值
void
noteChange()
noteChange(
note):void
定义于:Graph.ts:425
参数
note
返回值
void
noteRemove()
noteRemove(
note):void
定义于:Graph.ts:428
参数
note
返回值
void
off()
off<
K>(event,handler):void
定义于:Graph.ts:258
类型参数
K
K extends keyof GraphEvents
参数
event
K
handler
GraphEvents[K]
返回值
void
on()
on<
K>(event,handler):void
定义于:Graph.ts:251
类型参数
K
K extends keyof GraphEvents
参数
event
K
handler
GraphEvents[K]
返回值
void
openTable()
openTable():
void
定义于:Graph.ts:1662
打开数据停靠区 — 图表的行作为从画布底部分离出来的可排序、可选择的网格。仅full模式,且仅当UI.table允许时;否则无操作。
现在,停靠栏可以容纳表格以外的窗格,因此这也会将表格的窗格置于前面:该调用是根据表格命名的,并且应该向您显示一个窗格。到达 UIManager.dock 或 activateDockTab() 即可在没有该区域的情况下行驶。
返回值
void
removeBySource()
removeBySource(
source):object
定义于:Graph.ts:592
删除消息来源所保证的所有内容。多个消息来源都证实了一个元素仍然存在,其中一个声称更轻——遵循相同的统一规则拓展撤消,并且是删除拓展带来的任何内容的唯一方式。
这是一个前向操作,是历史中的一个条目:撤消它会放回剩下的内容,并将源的声明交还给留下的内容。
参数
source
string
拓展表 ID,或 'seed' 表示从未透视过的数据。
返回值
object
实际被删除的是什么。
edges
edges:
Edge[]
nodes
nodes:
Node[]
removeEdge()
removeEdge(
id):void
定义于:Graph.ts:1062
通过 ID 从图中删除一条边。
参数
id
string
要删除的边的 ID。边缘移除后触发onChange。
返回值
void
removeFromSelection()
removeFromSelection(
nodes):void
定义于:Graph.ts:1648
从当前选择中删除节点,保留其余部分。仅节点,与 addToSelection 相同。
参数
nodes
Node[]
要删除的 Node。
返回值
void
removeNode()
removeNode(
id):void
定义于:Graph.ts:969
根据节点 ID 从图中删除节点。
还删除连接到该节点的所有边。
参数
id
string
要删除的节点的 ID。节点及其边被删除后触发onChange。
返回值
void
selectElement()
selectElement(
element):void
定义于:Graph.ts:1593
选择图中的给定节点或边。隐藏在封闭簇或组中的节点仍然是被选择的节点;画布照亮为其绘制的簇或组。
参数
element
要选择的 Node 或 Edge。
返回值
void
selectElements()
selectElements(
elements):void
定义于:Graph.ts:1610
选择多个节点或多个边,替换当前选择 - 复数 selectElement,为您解析每个元素的渲染句柄。
节点和边不能一起选择(交互层在设置另一种时清除一种),因此混合数组选择 nodes 并发出警告。
参数
elements
要选择的 Node 或 Edge。空数组会清除选择。
返回值
void
setData()
setData(
nodes,edges,notes):void
定义于:Graph.ts:852
用提供的数据替换图中的所有当前节点和边。在设置新节点和边之前清除现有节点和边。更新后触发onChange回调。
参数
nodes
Node[] = []
要设置的节点数组。默认为空数组。
edges
Edge[] = []
要设置的边数组。默认为空数组。
notes
Note[] = []
返回值
void
setLegend()
setLegend(
config?):void
定义于:Graph.ts:450
在运行时替换画布图例——UI.legend的命令式双胞胎。一张没有任何开始的图表可以当场构建; false 清空图例并删除其过滤器,并且 true / undefined 回退到从 render.nodeTypeAccessor 派生一个。传递 LegendGroupOptions 一次在多个维度上对图进行关键操作。
参数
config?
要显示的图例,或 false 将其删除。
boolean | LegendOptions | LegendGroupOptions
返回值
void
setNotes()
setNotes(
notes):Note[]
定义于:Graph.ts:1282
替换图形的注释,仅保留节点和边。注释通过 id 进行匹配:画布上已有的注释会就地更新,因此其绘图仍与其绑定,不在 notes 中的注释将被删除,并添加新的注释。
参数
notes
(Note | NoteOptions)[]
返回值
Note[]
注释现在按给定的顺序显示在图表上。
投掷
如果两个条目共享一个 ID,则会出错。那么什么都没有改变。
setVisibleNodes()
setVisibleNodes(
nodes,notify):boolean
定义于:Graph.ts:1356
返回是否有任何移动,因此仅边缘过滤器更改可以重新绘制自身。 notify 对于查询引擎的第一遍是关闭的,它在绘制任何内容之前运行 - 构造函数自己的 simulation.update() / renderer.init() 跟随它。
参数
nodes
Node[]
notify
boolean = true
返回值
boolean
showForecast()
showForecast(
forecast):void
定义于:Graph.ts:1740
画出一个动作会做什么,不要改变其他任何东西:它会带走的元素原地流失,它会隐藏的元素,以及它会带回来的任何东西都勾勒出它会落在哪里。
当 emphasiseElements 通过后退其余部分从画布中读取一组时,预测会回答“如果我单击会发生什么”,因此图表必须围绕少数会发生变化的元素保持正常读取。 graph.history.preview(...) 返回一件现成的。
参数
forecast
返回值
void
showNode()
showNode(
node):void
定义于:Graph.ts:1404
参数
node
返回值
void
toggleExpandNode()
toggleExpandNode(
node):void
定义于:Graph.ts:1415
参数
node
返回值
void
toggleExpandNodes()
toggleExpandNodes(
nodes):void
定义于:Graph.ts:1420
参数
nodes
Node[]
返回值
void
toggleTable()
toggleTable():
void
定义于:Graph.ts:1674
如果数据坞已关闭,则将其打开;如果数据坞已打开,则将其关闭。
返回值
void
unHighlightElement()
unHighlightElement(
element):void
定义于:Graph.ts:1699
删除给定节点或边的高亮类
参数
element
要选择的 Node 或 Edge。
返回值
void
updateData()
updateData(
newNodes?,newEdges?,triggerChangeEvent?):void
定义于:Graph.ts:764
使用新节点和/或边更新图形。
图表已经保存的 id 会在原地进行更新:元素是的内容——它的数据、样式和权重——变成了你所传递的内容,而对象本身保留了它的身份。它必须以这种方式运作。它的边缘、模拟和 DOM 绑定都保存着该对象,自构建以来它所学到的一切也是如此:哪些来源为其提供担保,它位于何处,是否被固定。传入元素上的位置仍然获胜,因此 updateData 可以移动某些内容并刷新它。添加了未知的 ID。
容器的 children 在这里不会被重组 - 将容器传递给 removeNode 和 addNode 来更改它所容纳的内容。
整个调用是一批:一个 dataBatchChanged 按给定的顺序列出每个添加和更改,然后重新渲染,无论它携带多少元素。
参数
newNodes?
Node[]
要更新或添加的可选节点数组。
newEdges?
Edge[]
要更新或添加的可选边数组。
triggerChangeEvent?
boolean = true
宣布就地变更。无论哪种方式都会宣布添加内容。
返回值
void
use()
use(
plugin):this
定义于:Graph.ts:246
安装PivotickPlugin。可以随时调用 - 插件的 UI 元素会赶上当前的生命周期阶段。返回 this 进行链接。
参数
plugin
返回值
this
属性
editing
readonlyediting:GraphEditingManager
定义于:Graph.ts:45
history
readonlyhistory:GraphHistory
定义于:Graph.ts:57
画布所容纳和显示的内容以及它是如何形成的:每一次摄取、删除、持久隐藏和手绘元素,连续可逆。有界和会话范围 - 它无法在重新加载后幸存。
i18n
readonlyi18n:I18n
定义于:Graph.ts:68
该图编写自己的文本的语言,从 GraphOptions.i18n 开始:消息查找、复数、数字、列表和排序格式。嵌套图共享其父图。
noteManager
noteManager:
NoteManager
定义于:Graph.ts:31
notifier
notifier:
Notifier
定义于:Graph.ts:32
pivots
readonlypivots:PivotManager
定义于:Graph.ts:51
拓展运行时:注册丰富内容,运行它们,对它们返回的内容进行分类,并撤消整个运行。存在于 Graph 而不是 UI 上,因为拓展产生 数据 — 并且因为它必须在构建 UI 之前存在。
queryEngine
queryEngine:
GraphQueryEngine
定义于:Graph.ts:35
renderer
renderer:
GraphRenderer
定义于:Graph.ts:33
simplify
readonlysimplify:Simplification
定义于:Graph.ts:62
将发挥相同作用的节点折叠到在其位置绘制的一组中。组是视图状态:getNodes(),getEdges(),表和历史查看成员。
simulation
simulation:
Simulation
定义于:Graph.ts:34