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.

61 lines
1.4 KiB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Network | Label stroke</title>
  5. <script type="text/javascript" src="../../../dist/vis.js"></script>
  6. <link href="../../../dist/vis.css" rel="stylesheet" type="text/css" />
  7. <style type="text/css">
  8. #mynetwork {
  9. width: 600px;
  10. height: 600px;
  11. border: 1px solid lightgray;
  12. background:#d1d1d1;
  13. }
  14. p {
  15. max-width:600px;
  16. }
  17. </style>
  18. <script src="../../googleAnalytics.js"></script>
  19. </head>
  20. <body>
  21. <p>The stroke of labels is fully can have a width and color. Edgelabels by default have a white stroke for clarity.</p>
  22. <div id="mynetwork"></div>
  23. <script type="text/javascript">
  24. // create an array with nodes
  25. var nodes = [
  26. {id: 1, label: 'Node 1', font: {strokeWidth: 3, strokeColor: 'white'}},
  27. {id: 2, label: 'Node 2'},
  28. {id: 3, label: 'Node 3'},
  29. {id: 4, label: 'Node 4'},
  30. {id: 5, label: 'Node 5'}
  31. ];
  32. // create an array with edges
  33. var edges = [
  34. {from: 1, to: 2, label: 'edgeLabel', font: {strokeWidth: 2, strokeColor : '#00ff00'}},
  35. {from: 1, to: 3, label: 'edgeLabel'},
  36. {from: 2, to: 4},
  37. {from: 2, to: 5}
  38. ];
  39. // create a network
  40. var container = document.getElementById('mynetwork');
  41. var data = {
  42. nodes: nodes,
  43. edges: edges
  44. };
  45. var options = {
  46. nodes : {
  47. shape: 'dot',
  48. size: 10
  49. }
  50. };
  51. var network = new vis.Network(container, data, options);
  52. </script>
  53. </body>
  54. </html>