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.

73 lines
2.4 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Graph2d | Scrolling and Sorting</title>
  5. <style type="text/css">
  6. body, html {
  7. font-family: sans-serif;
  8. }
  9. </style>
  10. <script src="../../dist/vis.js"></script>
  11. <link href="../../dist/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
  12. </head>
  13. <body>
  14. <h2>Graph2d | Scrolling and Sorting</h2>
  15. <div style="width:700px; font-size:14px; text-align: justify;">
  16. You can determine the height of the Graph2d seperately from the height of the frame. If the <code>graphHeight</code>
  17. is defined, and the <code>height</code> is not, the frame will auto-scale to accommodate the graphHeight. If the <code>height</code>
  18. is defined as well, the user can scroll up and down vertically as well as horizontally to view the graph.
  19. <br /><br />
  20. Vertical scrolling is planned, though not yet available. The graphHeight also does not conform if only the <code>height</code> is defined.
  21. <br /><br />
  22. You can manually disable the automatic sorting of the datapoints by using the <code>sort</code> option. However, doing so does reduce the optimization
  23. of the drawing so if you have a lot of points, keep <code>sort</code> turned on for the best results.
  24. </div>
  25. <br />
  26. <div id="visualization"></div>
  27. <script type="text/javascript">
  28. var container = document.getElementById('visualization');
  29. var items = [
  30. {x: '2014-06-11', y: 10},
  31. {x: '2014-06-12', y: 25},
  32. {x: '2014-06-13', y: 30},
  33. {x: '2014-06-14', y: 10},
  34. {x: '2014-06-15', y: 15},
  35. {x: '2014-06-16', y: 30},
  36. {x: '2014-06-11', y: 100},
  37. {x: '2014-06-12', y: 250},
  38. {x: '2014-06-13', y: 300},
  39. {x: '2014-06-14', y: 100},
  40. {x: '2014-06-15', y: 150},
  41. {x: '2014-06-16', y: 300},
  42. {x: '2014-06-11', y: 400},
  43. {x: '2014-06-12', y: 450},
  44. {x: '2014-06-13', y: 400},
  45. {x: '2014-06-14', y: 500},
  46. {x: '2014-06-15', y: 420},
  47. {x: '2014-06-16', y: 600},
  48. {x: '2014-06-11', y: 810},
  49. {x: '2014-06-12', y: 825},
  50. {x: '2014-06-13', y: 830},
  51. {x: '2014-06-14', y: 810},
  52. {x: '2014-06-15', y: 815},
  53. {x: '2014-06-16', y: 900}
  54. ];
  55. var dataset = new vis.DataSet(items);
  56. var options = {
  57. legend: true,
  58. sort: false,
  59. defaultGroup: 'doodle',
  60. graphHeight: '1500px',
  61. height: '500px',
  62. start: '2014-06-10',
  63. end: '2014-06-18'
  64. };
  65. var graph2d = new vis.Graph2d(container, dataset, options);
  66. </script>
  67. </body>
  68. </html>