vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.6 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JS Bin</title>
  6. <script type="text/javascript" src="../dist/vis.js"></script>
  7. <link href="../dist/vis.css" rel="stylesheet" type="text/css" />
  8. <style>
  9. #mynetwork {
  10. width: 700px;
  11. height: 450px;
  12. border: 1px solid lightgray;
  13. }
  14. </style>
  15. <style type="text/css">
  16. #mynetwork {
  17. width: 600px;
  18. height: 400px;
  19. border: 1px solid lightgray;
  20. }
  21. </style>
  22. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
  23. <link rel="stylesheet" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  24. </head>
  25. <body>
  26. <p>
  27. Create a simple network with some nodes and edges.
  28. </p>
  29. <div id="mynetwork"></div>
  30. <script type="text/javascript">
  31. // create an array with nodes
  32. var nodes = new vis.DataSet([
  33. {id: 1, label: 'Node 1',shape: 'icon',
  34. icon: {
  35. face: 'FontAwesome',
  36. code: '\uf0c0',
  37. size: 50,
  38. color: 'rgba(255,0,0,0.5)'
  39. }},
  40. {id: 3, label: 'Node 3', color:'rgba(0,0,0,0.5)'},
  41. ]);
  42. // create an array with edges
  43. var edges = new vis.DataSet([
  44. {from: 1, to: 3},
  45. ]);
  46. // create a network
  47. var container = document.getElementById('mynetwork');
  48. var data = {
  49. nodes: nodes,
  50. edges: edges
  51. };
  52. var options = {edges:{arrows:'from'}};
  53. var network = new vis.Network(container, data, options);
  54. </script>
  55. </body>
  56. </html>