[英]call javascript infovis sunburst rotate function outside init
I would like to simulate the click of a sunburst node from a menu outside of the canvas so that the clicked node is rotated until its horizontal, which is what happens when a node is clicked on the canvas. 我想从画布外部的菜单中模拟朝阳节点的单击,以便将被单击的节点旋转到其水平,这就是在画布上单击节点时发生的情况。
The function: 功能:
sb.rotate(node, method, opt)
where node is the value of "ID" in the JSON array, method is either 'animate' or 'replot' and opt is the configuration object 其中,node是JSON数组中“ ID”的值,method是“ animate”或“ replot”,而opt是配置对象
This is the type of error I get when I execute 这是我执行时遇到的错误类型
sb.rotate("mynode", 'animate', "opt");
TypeError: node.getPos is not a function.
TypeError:node.getPos不是函数。 (In 'node.getPos(opt.property || 'current')', 'node.getPos' is undefined)
(在'node.getPos(opt.property ||'当前')'中,'node.getPos'未定义)
Any suggestions on how to get this to work? 关于如何使它起作用的任何建议?
In your jsbin, you have to use 在您的jsbin中,您必须使用
sb.rotate(sb.graph.getNode("Source/Core/Core.js"), animate? 'animate' :
'replot',
{
duration: 1000,
transition: $jit.Trans.Quart.easeInOut
});
Notice the sb.graph.getNode("Source/Core/Core.js")
注意
sb.graph.getNode("Source/Core/Core.js")
See https://philogb.github.io/jit/static/v20/Docs/files/Graph/Graph-js.html#Graph.getNode 参见https://philogb.github.io/jit/static/v20/Docs/files/Graph/Graph-js.html#Graph.getNode
You also forgot to issue the click in the jsbin. 您还忘记了在jsbin中发出点击。 Use
采用
button.click();
for that. 为了那个原因。 ;)
;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.