|
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Timeline | Background areas</title>
|
|
|
|
<style>
|
|
body, html {
|
|
font-family: arial, sans-serif;
|
|
font-size: 11pt;
|
|
}
|
|
|
|
.vis.timeline .item.background.negative {
|
|
background-color: rgba(255, 0, 0, 0.2);
|
|
}
|
|
.vis.timeline .item.background.positive {
|
|
background-color: rgba(105, 255, 98, 0.20);
|
|
}
|
|
.vis.timeline .item.background.marker {
|
|
border-left: 2px solid green;
|
|
}
|
|
</style>
|
|
|
|
<script src="../../dist/vis.js"></script>
|
|
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
|
|
<p>This example demonstrates the item type "background", see "Period A" and "Period B". The background areas can be styled with css.</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' }
|
|
});
|
|
var groups = new vis.DataSet([{
|
|
id: 'bar', content:'bar'
|
|
},{
|
|
id: 'foo', content:'foo'
|
|
}]);
|
|
// add items to the DataSet
|
|
items.add([
|
|
{id: 'A', content:'1',start: '2014-01-20', end: '2014-01-22', type: 'background', group:'foo'},
|
|
{id: 'B', content:'1',start: '2014-01-22', end: '2014-01-23', type: 'background', group:'foo', className: 'negative'},
|
|
{id: 0, content: 'item 4', start: '2014-01-20', end: '2014-01-22',group:'foo'},
|
|
|
|
{id: 'ab', content:'1',start: '2014-01-25', end: '2014-01-27', type: 'background', group:'bar', subgroup:'banana'},
|
|
{id: 'bb', content:'1',start: '2014-01-26', end: '2014-01-27', type: 'background', className: 'positive',group:'bar', subgroup:'banana'},
|
|
{id: 1, content: '0', start: '2014-01-25 12:00:00', end: '2014-01-26 12:00:00',group:'bar', subgroup:'banana'},
|
|
{id: 'aab', content:'1',start: '2014-01-27', end: '2014-01-29', type: 'background', group:'bar', subgroup:'putty'},
|
|
{id: 'bab', content:'1',start: '2014-01-27', end: '2014-01-28', type: 'background', className: 'negative',group:'bar', subgroup:'putty'},
|
|
{id: 'bdab', content:'1',start: '2014-01-29', end: '2014-01-30', type: 'background', className: 'negative',group:'bar'},
|
|
{id: 2, content: 'subgroup1', start: '2014-01-27', end: '2014-01-29',group:'bar', subgroup:'putty'},
|
|
]);
|
|
|
|
var container = document.getElementById('visualization');
|
|
var options = {
|
|
start: '2014-01-10',
|
|
end: '2014-02-10',
|
|
editable: true,
|
|
stack: false,
|
|
// orientation:'top'
|
|
};
|
|
|
|
var timeline = new vis.Timeline(container, items, groups, options);
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|