|
|
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>Timeline | Dataset example</title>
-
- <style>
- body, html {
- font-family: arial, sans-serif;
- font-size: 11pt;
- height: 100%;
- margin: 0;
- padding: 0;
- }
-
- #visualization {
- box-sizing: border-box;
- width: 100%;
- height: 100%;
- }
- </style>
-
- <!-- note: moment.js must be loaded before vis.js, else vis.js uses its embedded version of moment.js -->
- <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.3.1/moment.min.js"></script>
-
- <script src="../../dist/vis.js"></script>
- <link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="visualization"></div>
-
- <script>
- var now = moment().minutes(0).seconds(0).milliseconds(0);
-
- // create a dataset with items
- var items = new vis.DataSet({
- convert: {
- start: 'Date',
- end: 'Date'
- }
- });
- 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: '100%',
- showCurrentTime: true
- };
-
- var timeline = new vis.Timeline(container, items, options);
-
- </script>
- </body>
- </html>
|