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.0 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  5. <meta content="utf-8" http-equiv="encoding">
  6. <title>Graph2d | Basic Example</title>
  7. <style type="text/css">
  8. body, html {
  9. font-family: sans-serif;
  10. }
  11. </style>
  12. <script src="../dist/vis.js"></script>
  13. <script src="./graph2dTestData.js"></script>
  14. <script src="./graph2dTestData2.js"></script>
  15. <link href="../dist/vis.css" rel="stylesheet" type="text/css" />
  16. <body>
  17. <h2>Graph2d | Basic Example</h2>
  18. <div style="width:700px; font-size:14px; text-align: justify;">
  19. </div>
  20. <br />
  21. <div id="visualization"></div>
  22. <div id="visualization2"></div>
  23. <script type="text/javascript">
  24. var groups = new vis.DataSet();
  25. groups.add({
  26. id: 'accuracy',
  27. content: 'accuracy'
  28. });
  29. //
  30. groups.add({
  31. id: 'latitude',
  32. content: 'latitude'
  33. })
  34. groups.add({
  35. id: 'longitude',
  36. content: 'longitude'
  37. })
  38. groups.add({
  39. id: 'timeTraveled',
  40. content: 'timeTraveled'
  41. })
  42. var items = [];
  43. var items2 = [];
  44. for (var i = 0; i < data.length; i++) {
  45. items.push({x:Number(data[i].date+'000'), y:data[i].value.accuracy, group:'accuracy'});
  46. items.push({x:Number(data[i].date+'000'), y:data[i].value.latitude, group:'latitude'});
  47. items.push({x:Number(data[i].date+'000'), y:data[i].value.longitude, group:'longitude'});
  48. }
  49. for (var i = 0; i < timeTraveledData.length; i++) {
  50. items2.push({x:Number(timeTraveledData[i].date+'000'), y:timeTraveledData[i].value, group:'timeTraveled'});
  51. }
  52. var container = document.getElementById('visualization');
  53. var container2 = document.getElementById('visualization2');
  54. var dataset = new vis.DataSet(items);
  55. var options = {
  56. interpolation:false
  57. };
  58. var graph2d = new vis.Graph2d(container, dataset,groups, options);
  59. var dataset2 = new vis.DataSet(items2);
  60. var graph2d2 = new vis.Graph2d(container2, dataset2,groups, options);
  61. </script>
  62. </body>
  63. </html>