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.

54 lines
1.8 KiB

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Timeline | Light bundle</title>
  5. <style type="text/css">
  6. body, html {
  7. font-family: arial;
  8. }
  9. p {
  10. max-width: 600px;
  11. }
  12. </style>
  13. <!--
  14. load external libraries
  15. -->
  16. <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.7.0/moment.min.js"></script>
  17. <script src="http://cdnjs.cloudflare.com/ajax/libs/hammer.js/1.0.5/hammer.min.js"></script>
  18. <script src="../../dist/vis-light.min.js"></script>
  19. <link href="../../dist/vis.min.css" rel="stylesheet" type="text/css" />
  20. </head>
  21. <body>
  22. <p>
  23. The light bundle of vis.js (<code>vis-light.js</code> or <code>vis-light.min.js</code>) don't have the external dependencies of moment.js and hammer.js bundled. You have to load these yourself before loading vis-light.js. This is useful in the case that your application is using moment.js and/or hammer.js itself too, in order not to load these libraries twice. Note that it is possible too to create your own vis.js bundle: the source code consists of common.js modules which is browserifiable.
  24. </p>
  25. <div id="visualization"></div>
  26. <script type="text/javascript">
  27. // DOM element where the Timeline will be attached
  28. var container = document.getElementById('visualization');
  29. // Create a DataSet (allows two way data-binding)
  30. var items = new vis.DataSet([
  31. {id: 1, content: 'item 1', start: '2014-04-20'},
  32. {id: 2, content: 'item 2', start: '2014-04-14'},
  33. {id: 3, content: 'item 3', start: '2014-04-18'},
  34. {id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-19'},
  35. {id: 5, content: 'item 5', start: '2014-04-25'},
  36. {id: 6, content: 'item 6', start: '2014-04-27', type: 'point'}
  37. ]);
  38. // Configuration for the Timeline
  39. var options = {
  40. editable: true
  41. };
  42. // Create a Timeline
  43. var timeline = new vis.Timeline(container, items, options);
  44. </script>
  45. </body>
  46. </html>