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. <title>Graph | Dashed lines</title>
  5. <style type="text/css">
  6. body {
  7. font: 10pt sans;
  8. }
  9. #mygraph {
  10. width: 600px;
  11. height: 600px;
  12. border: 1px solid lightgray;
  13. }
  14. </style>
  15. <script type="text/javascript" src="../../vis.js"></script>
  16. <script type="text/javascript">
  17. // Called on page load
  18. function draw() {
  19. var nodes = [
  20. {id: 1, label: 'dashed\nline\nexamples'},
  21. {id: 2, label: 'default'},
  22. {id: 3, label: 'dash.length: 20\ndash.gap: 20'},
  23. {id: 4, label: 'dash.length: 20\ndash.gap: 5'},
  24. {id: 5, label: 'dash.length: 5\ndash.gap: 20'},
  25. {id: 6, label: 'dash.length: 20\ndash.gap: 5\ndash.altLength: 5'}
  26. ];
  27. var edges = [
  28. {from: 1, to: 2, style: 'dash-line'},
  29. {from: 1, to: 3, style: 'dash-line', dash: {length: 20, gap: 20}},
  30. {from: 1, to: 4, style: 'dash-line', dash: {length: 20, gap: 5}},
  31. {from: 1, to: 5, style: 'dash-line', dash: {length: 5, gap: 20}},
  32. {from: 1, to: 6, style: 'dash-line', dash: {length: 20, gap: 5, altLength: 5}}
  33. ];
  34. // create the graph
  35. var container = document.getElementById('mygraph');
  36. var data = {
  37. nodes: nodes,
  38. edges: edges
  39. };
  40. var options = {
  41. nodes: {
  42. shape: 'box'
  43. },
  44. edges: {
  45. length: 180
  46. },
  47. stabilize: false
  48. };
  49. var graph = new vis.Graph(container, data, options);
  50. }
  51. </script>
  52. </head>
  53. <body onload="draw();">
  54. <p>
  55. This example shows the different options for dashed lines.
  56. </p>
  57. <div id="mygraph"></div>
  58. </body>
  59. </html>