|
|
@ -1,7 +1,7 @@ |
|
|
|
<!DOCTYPE HTML> |
|
|
|
<html> |
|
|
|
<head> |
|
|
|
<title>Timeline demo</title> |
|
|
|
<title>Timeline | Dataset example</title> |
|
|
|
|
|
|
|
<style> |
|
|
|
body, html { |
|
|
@ -14,10 +14,6 @@ |
|
|
|
width: 100%; |
|
|
|
height: 300px; |
|
|
|
} |
|
|
|
|
|
|
|
#visualization .itemset { |
|
|
|
/*background: rgba(255, 255, 0, 0.5);*/ |
|
|
|
} |
|
|
|
</style> |
|
|
|
|
|
|
|
<script src="../../vis.js"></script> |
|
|
@ -26,8 +22,9 @@ |
|
|
|
<div id="visualization"></div> |
|
|
|
|
|
|
|
<script> |
|
|
|
// create a dataset with items |
|
|
|
var now = moment().minutes(0).seconds(0).milliseconds(0); |
|
|
|
|
|
|
|
// create a dataset with items |
|
|
|
var data = new vis.DataSet({ |
|
|
|
fieldTypes: { |
|
|
|
start: 'Date', |
|
|
@ -35,18 +32,19 @@ |
|
|
|
} |
|
|
|
}); |
|
|
|
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', 3).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()} |
|
|
|
{id: 1, content: 'item 1<br>start', start: now.clone().add('days', 4)}, |
|
|
|
{id: 2, content: 'item 2', start: now.clone().add('days', -2)}, |
|
|
|
{id: 3, content: 'item 3', start: now.clone().add('days', 2)}, |
|
|
|
{id: 4, content: 'item 4', start: now.clone().add('days', 0), end: now.clone().add('days', 3).toDate()}, |
|
|
|
{id: 5, content: 'item 5', start: now.clone().add('days', 9), type:'point'}, |
|
|
|
{id: 6, content: 'item 6', start: now.clone().add('days', 11)} |
|
|
|
]); |
|
|
|
|
|
|
|
var container = document.getElementById('visualization'); |
|
|
|
var options = { |
|
|
|
start: now.clone().add('days', -3).valueOf(), |
|
|
|
end: now.clone().add('days', 7).valueOf() |
|
|
|
start: now.clone().add('days', -3), |
|
|
|
end: now.clone().add('days', 7), |
|
|
|
height: '100%' |
|
|
|
}; |
|
|
|
|
|
|
|
var timeline = new vis.Timeline(container, data, options); |
|
|
|