<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Timeline demo - a lot of data</title>
|
|
|
|
<style>
|
|
body, html {
|
|
font-family: arial, sans-serif;
|
|
font-size: 11pt;
|
|
}
|
|
|
|
#visualization {
|
|
}
|
|
|
|
#visualization .itemset {
|
|
/*background: rgba(255, 255, 0, 0.5);*/
|
|
}
|
|
</style>
|
|
|
|
<script src="../../vis.js"></script>
|
|
</head>
|
|
<body>
|
|
<p>
|
|
Test with a lot of data
|
|
</p>
|
|
<p>
|
|
<label for="count">Number of items</label>
|
|
<input id="count" value="100">
|
|
<input id="draw" type="button" value="draw">
|
|
</p>
|
|
<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'
|
|
}
|
|
});
|
|
|
|
// create data
|
|
function createData() {
|
|
var count = parseInt(document.getElementById('count').value) || 100;
|
|
var newData = [];
|
|
for (var i = 0; i < count; i++) {
|
|
newData.push({id: i, content: 'item ' + i, start: now.clone().add('days', i).toDate()});
|
|
}
|
|
data.clear();
|
|
data.add(newData);
|
|
}
|
|
createData();
|
|
|
|
document.getElementById('draw').onclick = createData;
|
|
|
|
var container = document.getElementById('visualization');
|
|
var options = {
|
|
start: now.clone().add('days', -3).valueOf(),
|
|
end: now.clone().add('days', 11).valueOf()
|
|
//maxHeight: 300,
|
|
//height: '300px',
|
|
//orientation: 'top'
|
|
};
|
|
|
|
var timeline = new vis.Timeline(container, data, options);
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|