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.

99 lines
2.9 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Graph2d | Interpolation</title>
  5. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  6. <style type="text/css">
  7. body, html {
  8. font-family: sans-serif;
  9. }
  10. </style>
  11. <script src="../../dist/vis.js"></script>
  12. </head>
  13. <body>
  14. <h2>Graph2D | Interpolation</h2>
  15. <div style="width:700px; font-size:14px; text-align: justify;">
  16. This example shows the most basic functionality of the vis.js Graph2D module. An array or a vis.Dataset can be used as input.
  17. In the following examples we'll explore the options Graph2D offest for customization. This example uses all default settings.
  18. There are 10 predefined styles that will be cycled through automatically when you add different groups. Alternatively you can
  19. create your own styling.
  20. <br /><br />
  21. Graph2D is built upon the framework of the newly refactored timeline. A lot of the timeline options will also apply to Graph2D.
  22. In these examples however, we will focus on what's new in Graph2D!
  23. </div>
  24. <br />
  25. <div id="visualization"></div>
  26. <script type="text/javascript">
  27. // create a dataSet with groups
  28. var names = ['centripetal', 'chordal', 'uniform', 'disabled'];
  29. var groups = new vis.DataSet();
  30. groups.add({
  31. id: 0,
  32. content: names[0],
  33. options: {
  34. drawPoints: false,
  35. catmullRom: {
  36. parametrization: 'centripetal'
  37. }
  38. }});
  39. groups.add({
  40. id: 1,
  41. content: names[1],
  42. options: {
  43. drawPoints: false,
  44. catmullRom: {
  45. parametrization: 'chordal'
  46. }
  47. }});
  48. groups.add({
  49. id: 2,
  50. content: names[2],
  51. options: {
  52. drawPoints: false,
  53. catmullRom: {
  54. parametrization: 'uniform'
  55. }
  56. }
  57. });
  58. groups.add({
  59. id: 3,
  60. content: names[3],
  61. options: {
  62. drawPoints: { style: 'circle' },
  63. catmullRom: false
  64. }});
  65. var container = document.getElementById('visualization');
  66. var dataset = new vis.DataSet();
  67. for (var i = 0; i < names.length; i++) {
  68. dataset.add( [
  69. {x: '2014-06-12', y: 0 , group: i},
  70. {x: '2014-06-13', y: 30, group: i},
  71. {x: '2014-06-14', y: 10, group: i},
  72. {x: '2014-06-15', y: 15, group: i},
  73. {x: '2014-06-15', y: 30, group: i},
  74. {x: '2014-06-17', y: 10, group: i},
  75. {x: '2014-06-18', y: 15, group: i},
  76. {x: '2014-06-19', y: 52, group: i},
  77. {x: '2014-06-20', y: 10, group: i},
  78. {x: '2014-06-21', y: 20, group: i}
  79. ]);
  80. }
  81. var options = {
  82. dataPoints: false,
  83. dataAxis: {visible: false},
  84. legend: true,
  85. start: '2014-06-10',
  86. end: '2014-06-22'
  87. };
  88. var graph2d = new vis.Graph2d(container, dataset, options, groups);
  89. </script>
  90. </body>
  91. </html>