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.

91 lines
2.6 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Graph2d | Shading Example</title>
  5. <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  6. <meta content="utf-8" http-equiv="encoding">
  7. <style type="text/css">
  8. body, html {
  9. font-family: sans-serif;
  10. }
  11. </style>
  12. <script src="../../dist/vis.js"></script>
  13. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  14. <script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-61231638-1', 'auto');ga('send', 'pageview');</script></head>
  15. <body>
  16. <h2>Graph2d | Shading Example</h2>
  17. <div style="width:700px; font-size:14px; text-align: justify;">
  18. This example shows the shading functionality within Graph2d.
  19. </div>
  20. <br />
  21. <div id="visualization"></div>
  22. <script type="text/javascript">
  23. // create a dataSet with groups
  24. var names = ['top', 'bottom', 'zero', 'none'];
  25. var groups = new vis.DataSet();
  26. groups.add({
  27. id: 0,
  28. content: names[0],
  29. options: {
  30. shaded: {
  31. orientation: 'top'
  32. }
  33. }});
  34. groups.add({
  35. id: 1,
  36. content: names[1],
  37. options: {
  38. shaded: {
  39. orientation: 'bottom'
  40. }
  41. }});
  42. groups.add({
  43. id: 2,
  44. content: names[2],
  45. options: {
  46. shaded: {
  47. orientation: 'zero'
  48. }
  49. }});
  50. groups.add({
  51. id: 3,
  52. content: names[3],
  53. });
  54. var container = document.getElementById('visualization');
  55. var items = [
  56. {x: '2014-06-10', y: 0, group: 0},
  57. {x: '2014-06-11', y: 15, group: 0},
  58. {x: '2014-06-13', y: -15, group: 0},
  59. {x: '2014-06-14', y: 0, group: 0},
  60. {x: '2014-06-15', y: 0, group: 1},
  61. {x: '2014-06-16', y: 15, group: 1},
  62. {x: '2014-06-17', y: -15, group: 1},
  63. {x: '2014-06-18', y: 0, group: 1},
  64. {x: '2014-06-19', y: 0, group: 2},
  65. {x: '2014-06-20', y: 15, group: 2},
  66. {x: '2014-06-21', y: -15, group: 2},
  67. {x: '2014-06-22', y: 0, group: 2},
  68. {x: '2014-06-23', y: 0, group: 3},
  69. {x: '2014-06-24', y: 15, group: 3},
  70. {x: '2014-06-25', y: -15, group: 3},
  71. {x: '2014-06-26', y: 0, group: 3},
  72. ];
  73. var dataset = new vis.DataSet(items);
  74. var options = {
  75. legend: true,
  76. start: '2014-06-05',
  77. end: '2014-06-29'
  78. };
  79. var graph2d = new vis.Graph2d(container, dataset, groups, options);
  80. </script>
  81. </body>
  82. </html>