|
|
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>Timeline | Group example</title>
-
- <style>
- body, html {
- font-family: arial, sans-serif;
- font-size: 11pt;
- }
-
- #visualization {
- box-sizing: border-box;
- width: 100%;
- height: 300px;
- }
- </style>
-
- <script src="../../vis.js"></script>
- </head>
- <body>
- <div id="visualization"></div>
-
- <script>
- var now = moment().minutes(0).seconds(0).milliseconds(0);
- var groupCount = 3;
- var itemCount = 20;
-
- // create a dataset with items
- var items = new vis.DataSet();
- for (var i = 0; i < itemCount; i++) {
- var start = now.clone().add('hours', Math.random() * 200);
- var group = Math.floor(Math.random() * groupCount);
- items.add({
- id: i,
- group: group,
- content: 'item ' + i,
- start: start,
- type: 'point'
- });
- }
-
- var groups = new vis.DataSet();
- for (var g = 0; g < groupCount; g++) {
- groups.add({id: g, content: 'Group ' + g});
- }
-
- var container = document.getElementById('visualization');
- var options = {};
-
- var timeline = new vis.Timeline(container);
- timeline.setOptions(options);
- timeline.setGroups(groups);
- timeline.setItems(items);
-
- </script>
- </body>
- </html>
|