- <!DOCTYPE HTML>
- <html>
- <head>
- <title>Timeline | Interactive example</title>
-
- <style>
- body, html {
- font-family: arial, sans-serif;
- font-size: 11pt;
- }
- </style>
-
- <script src="../../dist/vis.js"></script>
- <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
- <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>
- <body>
-
- <p>Drag items around, create new items, and remove items.</p>
-
- <div id="visualization"></div>
-
- <script>
- // create a dataset with items
- // we specify the type of the fields `start` and `end` here to be strings
- // containing an ISO date. The fields will be outputted as ISO dates
- // automatically getting data from the DataSet via items.get().
- var items = new vis.DataSet({
- type: { start: 'ISODate', end: 'ISODate' }
- });
-
- // add items to the DataSet
- items.add([
- {id: 1, content: 'item 1<br>start', start: '2014-01-23'},
- {id: 2, content: 'item 2', start: '2014-01-18'},
- {id: 3, content: 'item 3', start: '2014-01-21'},
- {id: 4, content: 'item 4', start: '2014-01-19', end: '2014-01-24'},
- {id: 5, content: 'item 5', start: '2014-01-28', type:'point'},
- {id: 6, content: 'item 6', start: '2014-01-26'}
- ]);
-
- var container = document.getElementById('visualization');
- var options = {
- start: '2014-01-10',
- end: '2014-02-10',
- orientation: 'top',
- height: '300px',
- editable: true,
-
- /* alternatively, enable/disable individual actions:
-
- editable: {
- add: true,
- updateTime: true,
- updateGroup: true,
- remove: true
- },
-
- */
-
- showCurrentTime: true
- };
-
- var timeline = new vis.Timeline(container, items, options);
-
- </script>
- </body>
- </html>
|