function addNode() { var newId = (Math.random() * 1e7).toString(32); nodes.add({id:newId, label:"I'm new!"}); nodeIds.push(newId); } function changeNode1() { var newColor = '#' + Math.floor((Math.random() * 255 * 255 * 255)).toString(16); nodes.update([{id:1, color:{background:newColor}}]); } function removeRandomNode() { var randomNodeId = nodeIds[Math.floor(Math.random() * nodeIds.length)]; nodes.remove({id:randomNodeId}); var index = nodeIds.indexOf(randomNodeId); nodeIds.splice(index,1); }
var org_nodes = new vis.DataSet([your_nodes]); var edges = new vis.DataSet([your_edges]);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)