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.

71 lines
2.3 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.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. Graph2D does not sort the data. It is plotted as it is inputted. If you want your data to be sorted, sort your data.
  23. </div>
  24. <br />
  25. <div id="visualization"></div>
  26. <script type="text/javascript">
  27. var container = document.getElementById('visualization');
  28. var items = [
  29. {x: '2014-06-11', y: 10},
  30. {x: '2014-06-12', y: 25},
  31. {x: '2014-06-13', y: 30},
  32. {x: '2014-06-14', y: 10},
  33. {x: '2014-06-15', y: 15},
  34. {x: '2014-06-16', y: 30},
  35. {x: '2014-06-11', y: 100},
  36. {x: '2014-06-12', y: 250},
  37. {x: '2014-06-13', y: 300},
  38. {x: '2014-06-14', y: 100},
  39. {x: '2014-06-15', y: 150},
  40. {x: '2014-06-16', y: 300},
  41. {x: '2014-06-11', y: 400},
  42. {x: '2014-06-12', y: 450},
  43. {x: '2014-06-13', y: 400},
  44. {x: '2014-06-14', y: 500},
  45. {x: '2014-06-15', y: 420},
  46. {x: '2014-06-16', y: 600},
  47. {x: '2014-06-11', y: 810},
  48. {x: '2014-06-12', y: 825},
  49. {x: '2014-06-13', y: 830},
  50. {x: '2014-06-14', y: 810},
  51. {x: '2014-06-15', y: 815},
  52. {x: '2014-06-16', y: 900}
  53. ];
  54. var dataset = new vis.DataSet(items);
  55. var options = {
  56. legend: true,
  57. defaultGroup: 'doodle',
  58. graphHeight: '1500px',
  59. height: '500px',
  60. start: '2014-06-10',
  61. end: '2014-06-18'
  62. };
  63. var graph2d = new vis.Graph2d(container, dataset, options);
  64. </script>
  65. </body>
  66. </html>