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.

62 lines
1.9 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: "dashlength: 20\ndashgap: 20"},
  23. {id: 4, label: "dashlength: 20\ndashgap: 5"},
  24. {id: 5, label: "dashlength: 5\ndashgap: 20"},
  25. {id: 6, label: "dashlength: 20\ndashgap: 5\naltdashlength: 5"}
  26. ];
  27. var edges = [
  28. {from: 1, to: 2, style: "dash-line"},
  29. {from: 1, to: 3, style: "dash-line", dashlength: 20, dashgap: 20},
  30. {from: 1, to: 4, style: "dash-line", dashlength: 20, dashgap: 5},
  31. {from: 1, to: 5, style: "dash-line", dashlength: 5, dashgap: 20},
  32. {from: 1, to: 6, style: "dash-line", dashlength: 20, dashgap: 5, altdashlength: 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. edges: {
  42. length: 200
  43. },
  44. stabilize: false
  45. };
  46. var graph = new vis.Graph(container, data, options);
  47. }
  48. </script>
  49. </head>
  50. <body onload="draw();">
  51. <p>
  52. This example shows the different options for dashed lines.
  53. </p>
  54. <div id="mygraph"></div>
  55. </body>
  56. </html>