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.

68 lines
1.9 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="../../vis.js"></script>
  18. </head>
  19. <body>
  20. <p>
  21. Load HTML contents in the Timeline
  22. </p>
  23. <div id="visualization"></div>
  24. <script>
  25. // create a couple of HTML items in various ways
  26. var item1 = document.createElement('div');
  27. item1.appendChild(document.createTextNode('item 1'));
  28. var item2 = document.createElement('div');
  29. item2.innerHTML = '<span>item 2</span>';
  30. var item3 = document.createElement('div');
  31. var span3 = document.createElement('span');
  32. span3.className = 'large';
  33. span3.appendChild(document.createTextNode('item 3'));
  34. item3.appendChild(span3);
  35. var item4 = 'item <span class="large">4</span>';
  36. var item5 = document.createElement('div');
  37. item5.appendChild(document.createTextNode('item 5'));
  38. item5.appendChild(document.createElement('br'));
  39. var img5 = document.createElement('img');
  40. img5.src = 'img/attachment-icon.png';
  41. img5.style.width = '48px';
  42. img5.style.height = '48px';
  43. item5.appendChild(img5);
  44. var item6 = 'item6<br><img src="img/comments-icon.png" style="width: 48px; height: 48px;">';
  45. // create data and a Timeline
  46. var container = document.getElementById('visualization');
  47. var items = [
  48. {id: 1, content: item1, start: '2013-04-20'},
  49. {id: 2, content: item2, start: '2013-04-14'},
  50. {id: 3, content: item3, start: '2013-04-18'},
  51. {id: 4, content: item4, start: '2013-04-16', end: '2013-04-19'},
  52. {id: 5, content: item5, start: '2013-04-25'},
  53. {id: 6, content: item6, start: '2013-04-27'}
  54. ];
  55. var options = {};
  56. var timeline = new vis.Timeline(container, items, options);
  57. </script>
  58. </body>
  59. </html>