- <!DOCTYPE html>
- <html>
- <head>
- <script src="../dist/vis.js"></script>
- <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.9.0/vis.min.css">
-
- <style>
- #mynetwork {
- width: 1400px;
- height: 800px;
- border: 1px solid gray;
- }
- </style>
- </head>
- <body onload="draw()">
- <script src="https://rawgit.com/Tooa/6e17f2d7b8e34ef94719/raw/a10096a6b88c992c57d032b1ed3079d7cc4b1f51/data.js"></script>
- <div id="mynetwork"></div>
- <script>
- function draw() {
- // create an array with nodes
- nodes = new vis.DataSet([
- {id: 1, label: 'N1', color:"#FF0000"},
- {id: 2, label: 'N2'}
- ]);
-
- edges = new vis.DataSet([
- {id: '1%2', from: 1, to: 2},
- {id: '2%1',from: 2, to: 1}
- ]);
-
- var container = document.getElementById('mynetwork');
- var data = {
- nodes: nodes,
- edges: edges
- };
- var options = {edges:{arrows:'to'}};
- network = new vis.Network(container, data, options);
-
- nodes.update({id: '1', color: null});
- nodes.update({id: '1', color: "#FF00FF"});
- }
-
- var network, nodes, edges;
-
-
- </script>
- </body>
- </html>
|