Reputation: 825
By default when you double click on a node in zoomchart net chart, it moves to the center of the radial graph. How to manually set any node to the center?
Upvotes: 0
Views: 36
Reputation: 4977
use focusNodes mode and update initialNodes.
var t = new NetChart(
{
container: document.getElementById("demo"),
area: { height: null },
data: { randomNodes: 100},
layout: {mode: "radial"},
navigation: {mode: "focusnodes", focusNodeExpansionRadius: 10}
}
);
function updateCenterNode(){
var data = t.exportData(false);
var node = data.nodes[Math.round(Math.random()*(data.nodes.length-1))];
console.log(node.id);
t.updateSettings(
{
navigation: {
initialNodes: [node.id]
}
}
);
}
setInterval(updateCenterNode, 3000); jsfiddle: https://jsfiddle.net/rfyxchpg/
Upvotes: 0