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.

74 lines
2.1 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | HTML data</title>
  5. <style>
  6. body, html {
  7. font-family: arial, sans-serif;
  8. font-size: 11pt;
  9. }
  10. span {
  11. color: red;
  12. }
  13. span.large {
  14. font-size: 200%;
  15. }
  16. </style>
  17. <script src="../../../dist/vis.js"></script>
  18. <link href="../../../dist/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
  19. <script src="../../googleAnalytics.js"></script>
  20. </head>
  21. <body>
  22. <p>
  23. Load HTML contents in the Timeline in various ways.
  24. </p>
  25. <div id="visualization"></div>
  26. <script>
  27. // create a couple of HTML items in various ways
  28. var item1 = document.createElement('div');
  29. item1.appendChild(document.createTextNode('item 1'));
  30. var item2 = document.createElement('div');
  31. item2.innerHTML = '<span>item 2</span>';
  32. var item3 = document.createElement('div');
  33. var span3 = document.createElement('span');
  34. span3.className = 'large';
  35. span3.appendChild(document.createTextNode('item 3'));
  36. item3.appendChild(span3);
  37. var item4 = 'item <span class="large">4</span>';
  38. var item5 = document.createElement('div');
  39. item5.appendChild(document.createTextNode('item 5'));
  40. item5.appendChild(document.createElement('br'));
  41. var img5 = document.createElement('img');
  42. img5.src = 'img/attachment-icon.png';
  43. img5.style.width = '48px';
  44. img5.style.height = '48px';
  45. item5.appendChild(img5);
  46. var item6 = 'item6<br><img src="../resources/img/comments-icon.png" style="width: 48px; height: 48px;">';
  47. var item7 = 'item7<br><a href="http://visjs.org" target="_blank">click here</a>';
  48. // create data and a Timeline
  49. var container = document.getElementById('visualization');
  50. var items = new vis.DataSet([
  51. {id: 1, content: item1, start: '2013-04-20'},
  52. {id: 2, content: item2, start: '2013-04-14'},
  53. {id: 3, content: item3, start: '2013-04-18'},
  54. {id: 4, content: item4, start: '2013-04-16', end: '2013-04-19'},
  55. {id: 5, content: item5, start: '2013-04-25'},
  56. {id: 6, content: item6, start: '2013-04-27'},
  57. {id: 7, content: item7, start: '2013-04-21'}
  58. ]);
  59. var options = {};
  60. var timeline = new vis.Timeline(container, items, options);
  61. </script>
  62. </body>
  63. </html>