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.
 
 
 

129 lines
4.2 KiB

<!DOCTYPE HTML>
<html>
<head>
<title></title>
<script>
var baseUrl = '../src/';
var modules = [
'../node_modules/moment/moment.js',
'util.js',
'events.js',
'timestep.js',
'dataset.js',
'stack.js',
'controller.js',
'range.js',
'component/component.js',
'component/panel.js',
'component/rootpanel.js',
'component/timeaxis.js',
'component/itemset.js',
'component/item/item.js',
'component/item/itembox.js',
'component/item/itemrange.js',
'component/item/itempoint.js',
'visualization/timeline.js'
];
function require(name) {
}
var module = {
exports: {}
};
</script>
<script src="../src/module.js"></script>
<script src="../src/util.js"></script>
<script src="../src/events.js"></script>
<script src="../src/timestep.js"></script>
<script src="../src/dataset.js"></script>
<script src="../src/stack.js"></script>
<script src="../src/controller.js"></script>
<script src="../src/range.js"></script>
<script src="../src/component/component.js"></script>
<script src="../src/component/panel.js"></script>
<script src="../src/component/rootpanel.js"></script>
<script src="../src/component/timeaxis.js"></script>
<script src="../src/component/itemset.js"></script>
<script src="../src/component/item/item.js"></script>
<script src="../src/component/item/itembox.js"></script>
<script src="../src/component/item/itemrange.js"></script>
<script src="../src/component/item/itempoint.js"></script>
<script src="../src/visualization/timeline.js"></script>
<link href="../src/component/css/panel.css" rel="stylesheet" type="text/css" />
<link href="../src/component/css/timeaxis.css" rel="stylesheet" type="text/css" />
<link href="../src/component/css/item.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body, html {
font-family: sans-serif;
font-size: 12pt;
}
#visualization .itemset {
/*background: rgba(255, 255, 0, 0.5);*/
}
</style>
</head>
<body>
<div>
<label for="orientation">Orientation</label>
<select id="orientation">
<option value="top">top</option>
<option value="bottom" selected>bottom</option>
</select>
</div>
<script>
var orientation = document.getElementById('orientation');
orientation.onchange = function () {
timeline.setOptions({
orientation: orientation.value
});
};
</script>
<br>
<div id="visualization"></div>
<script>
// create a dataset with items
var now = moment().minutes(0).seconds(0).milliseconds(0);
var data = new vis.DataSet({
fieldTypes: {
start: 'Date',
end: 'Date'
}
});
data.add([
{id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4).toDate()},
{id: 2, content: 'item 2', start: now.clone().add('days', -2).toDate() },
{id: 3, content: 'item 3', start: now.clone().add('days', 2).toDate()},
{id: 4, content: 'item 4',
start: now.clone().add('days', 0).toDate(),
end: now.clone().add('days', 7).toDate()},
{id: 5, content: 'item 5', start: now.clone().add('days', 9).toDate(), type:'point'},
{id: 6, content: 'item 6', start: now.clone().add('days', 11).toDate()}
]);
var container = document.getElementById('visualization');
var options = {
//start: now.clone().add('days', -7).valueOf(),
//end: now.clone().add('days', 7).valueOf(),
min: moment('2013-01-01').valueOf(),
max: moment('2013-12-31').valueOf(),
zoomMin: 1000 * 60 * 60 * 24, // 1 day
zoomMax: 1000 * 60 * 60 * 24 * 30 * 6 // 6 months
};
var timeline = new vis.Timeline(container, data, options);
</script>
</body>
</html>