gpt4 book ai didi

javascript - 在 init 之外调用 javascript infovis sunburst 旋转函数

转载 作者:行者123 更新时间:2023-12-03 04:19:11 25 4
gpt4 key购买 nike

我想模拟从 Canvas 外部的菜单中单击旭日节点,以便单击的节点旋转直到其水平,这就是在 Canvas 上单击节点时发生的情况。

功能:

sb.rotate(node, method, opt)

参见rotate

其中节点是 JSON 数组中“ID”的值,方法是“animate”或“replot”,opt 是配置对象

这是我执行时遇到的错误类型

sb.rotate("mynode", 'animate', "opt");

TypeError: node.getPos is not a function. (In 'node.getPos(opt.property || 'current')', 'node.getPos' is undefined)

关于如何让它发挥作用有什么建议吗?

jsbin example

最佳答案

在你的jsbin中,你必须使用

sb.rotate(sb.graph.getNode("Source/Core/Core.js"), animate? 'animate' : 
'replot',
{
duration: 1000,
transition: $jit.Trans.Quart.easeInOut
});

注意sb.graph.getNode("Source/Core/Core.js")
请参阅https://philogb.github.io/jit/static/v20/Docs/files/Graph/Graph-js.html#Graph.getNode

您还忘记在 jsbin 中发出单击。使用

button.click();

为此。 ;)

关于javascript - 在 init 之外调用 javascript infovis sunburst 旋转函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44020630/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com