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

call javascript infovis sunburst rotate function outside init

我想模拟从 canvas 外部的菜单中单击 sunburst 节点,以便将单击的节点旋转到水平位置,这就是在 [= 上单击节点时发生的情况=33=].

函数:

sb.rotate(node, method, opt)

rotate

其中node是JSON数组中"ID"的值,method是'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();

为此。 ;)