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

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