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.

42 lines
1.7 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | Basic demo</title>
  5. <style type="text/css">
  6. body, html {
  7. font-family: sans-serif;
  8. }
  9. </style>
  10. <script src="../../dist/vis.js"></script>
  11. <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
  12. <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></head>
  13. <body>
  14. <p>
  15. In this example all items get HTML attributes attached: each item gets <code>data-?</code> attributes for each field defined on the JS object.
  16. </p>
  17. <div id="visualization"></div>
  18. <script type="text/javascript">
  19. // DOM element where the Timeline will be attached
  20. var container = document.getElementById('visualization');
  21. // Create a DataSet (allows two way data-binding)
  22. var items = new vis.DataSet([
  23. {id: 1, content: 'item 1', start: '2014-04-20', tooltip: 'This is item 1'},
  24. {id: 2, content: 'item 2', start: '2014-04-14'},
  25. {id: 3, content: 'item 3', start: '2014-04-18'},
  26. {id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-19'},
  27. {id: 5, content: 'item 5', start: '2014-04-25'},
  28. {id: 6, content: 'item 6', start: '2014-04-27', type: 'point', tooltip: 'This is item 6'}
  29. ]);
  30. // Configuration for the Timeline
  31. var options = {dataAttributes: 'all'};
  32. // Create a Timeline
  33. var timeline = new vis.Timeline(container, items, options);
  34. </script>
  35. </body>
  36. </html>