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.

117 lines
3.3 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', 'group', '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. options: {
  53. excludeFromLegend: true
  54. }
  55. });
  56. groups.add({
  57. id: 4,
  58. content: names[4],
  59. options: {
  60. shaded: {
  61. orientation: 'group',
  62. groupId: '3'
  63. }
  64. }
  65. });
  66. groups.add({
  67. id: 5,
  68. content: names[5]
  69. });
  70. var container = document.getElementById('visualization');
  71. var items = [
  72. {x: '2014-06-11', y: 0, group: 0},
  73. {x: '2014-06-12', y: 15, group: 0},
  74. {x: '2014-06-13', y: -15, group: 0},
  75. {x: '2014-06-14', y: 0, group: 0},
  76. {x: '2014-06-15', y: 0, group: 1},
  77. {x: '2014-06-16', y: 15, group: 1},
  78. {x: '2014-06-17', y: -15, group: 1},
  79. {x: '2014-06-18', y: 0, group: 1},
  80. {x: '2014-06-19', y: 0, group: 2},
  81. {x: '2014-06-20', y: 15, group: 2},
  82. {x: '2014-06-21', y: -15, group: 2},
  83. {x: '2014-06-22', y: 0, group: 2},
  84. {x: '2014-06-23', y: -2, group: 3},
  85. {x: '2014-06-24', y: 13, group: 3},
  86. {x: '2014-06-25', y: -17, group: 3},
  87. {x: '2014-06-26', y: -2, group: 3},
  88. {x: '2014-06-23', y: 2, group: 4},
  89. {x: '2014-06-24', y: 17, group: 4},
  90. {x: '2014-06-25', y: -13, group: 4},
  91. {x: '2014-06-26', y: 2, group: 4},
  92. {x: '2014-06-27', y: 0, group: 5},
  93. {x: '2014-06-28', y: 15, group: 5},
  94. {x: '2014-06-29', y: -15, group: 5},
  95. {x: '2014-06-30', y: 0, group: 5}
  96. ];
  97. var dataset = new vis.DataSet(items);
  98. var options = {
  99. legend: true,
  100. start: '2014-06-07',
  101. end: '2014-07-03'
  102. };
  103. var graph2d = new vis.Graph2d(container, dataset, groups, options);
  104. </script>
  105. </body>
  106. </html>