Cytoscape 消失边缘与贝塞尔曲线和节点 moving/longer 节点中的标签
Cytoscape disappearing edges with bezier curves and nodes moving/longer labels in nodes
我正在使用带有贝塞尔曲线的 cytoscape,但当具有较长标签的节点或只是将源节点移动到目标节点旁边时,边缘会消失。
- 视频:https://www.screencast.com/t/N2f5eZ5M7
- 可运行示例:https://stackblitz.com/edit/web-platform-vpl72r?file=index.html
我已经看到“边 xxxxx 的端点无效,因此无法绘制”警告并搜索了相应的 threads 但找不到解决方案。
有人知道怎么处理吗?
我在控制台上看到一些警告
The style value of label
is deprecated for width
The style value of label
is deprecated for height
我删除后'width': 'label', 'height':'label',
就没再出现这个问题
--- 更新 1.1 ---
but I'd like to have node's dimensions based on label's dimensions.
为此,我认为您应该编写一个函数样式。请参见下面的示例。在示例中,您可以看到我们正在根据 name
长度动态设置节点的大小。我假设 name
是一个存储标签的字符串。
cy.style().selector('node').style({
'width': (x) => { return x.data('name').length + 'px;' }
'height': (x) => { return x.data('name').length + 'px;' }
}).update();
我正在使用带有贝塞尔曲线的 cytoscape,但当具有较长标签的节点或只是将源节点移动到目标节点旁边时,边缘会消失。
- 视频:https://www.screencast.com/t/N2f5eZ5M7
- 可运行示例:https://stackblitz.com/edit/web-platform-vpl72r?file=index.html
我已经看到“边 xxxxx 的端点无效,因此无法绘制”警告并搜索了相应的 threads 但找不到解决方案。
有人知道怎么处理吗?
我在控制台上看到一些警告
The style value of
label
is deprecated forwidth
The style value of
label
is deprecated forheight
我删除后'width': 'label', 'height':'label',
就没再出现这个问题
--- 更新 1.1 ---
but I'd like to have node's dimensions based on label's dimensions.
为此,我认为您应该编写一个函数样式。请参见下面的示例。在示例中,您可以看到我们正在根据 name
长度动态设置节点的大小。我假设 name
是一个存储标签的字符串。
cy.style().selector('node').style({
'width': (x) => { return x.data('name').length + 'px;' }
'height': (x) => { return x.data('name').length + 'px;' }
}).update();