@ -1,31 +1,32 @@ | |||||
<!DOCTYPE HTML> | <!DOCTYPE HTML> | ||||
<html> | <html> | ||||
<head> | <head> | ||||
<title>Timeline | Basic demo</title> | |||||
<title>Timeline | Basic demo</title> | |||||
<style type="text/css"> | |||||
body, html { | |||||
font-family: sans-serif; | |||||
} | |||||
</style> | |||||
<style type="text/css"> | |||||
body, html { | |||||
font-family: sans-serif; | |||||
} | |||||
</style> | |||||
<script src="../../vis.js"></script> | |||||
<script src="../../dist/vis.js"></script> | |||||
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||||
</head> | </head> | ||||
<body> | <body> | ||||
<div id="visualization"></div> | <div id="visualization"></div> | ||||
<script type="text/javascript"> | <script type="text/javascript"> | ||||
var container = document.getElementById('visualization'); | |||||
var items = [ | |||||
{id: 1, content: 'item 1', start: '2013-04-20'}, | |||||
{id: 2, content: 'item 2', start: '2013-04-14'}, | |||||
{id: 3, content: 'item 3', start: '2013-04-18'}, | |||||
{id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'}, | |||||
{id: 5, content: 'item 5', start: '2013-04-25'}, | |||||
{id: 6, content: 'item 6', start: '2013-04-27'} | |||||
]; | |||||
var options = {}; | |||||
var timeline = new vis.Timeline(container, items, options); | |||||
var container = document.getElementById('visualization'); | |||||
var items = [ | |||||
{id: 1, content: 'item 1', start: '2013-04-20'}, | |||||
{id: 2, content: 'item 2', start: '2013-04-14'}, | |||||
{id: 3, content: 'item 3', start: '2013-04-18'}, | |||||
{id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'}, | |||||
{id: 5, content: 'item 5', start: '2013-04-25'}, | |||||
{id: 6, content: 'item 6', start: '2013-04-27'} | |||||
]; | |||||
var options = {}; | |||||
var timeline = new vis.Timeline(container, items, options); | |||||
</script> | </script> | ||||
</body> | </body> | ||||
</html> | </html> |
@ -1,61 +1,62 @@ | |||||
<!DOCTYPE HTML> | <!DOCTYPE HTML> | ||||
<html> | <html> | ||||
<head> | <head> | ||||
<title>Timeline | Dataset example</title> | |||||
<style> | |||||
body, html { | |||||
font-family: arial, sans-serif; | |||||
font-size: 11pt; | |||||
height: 100%; | |||||
margin: 0; | |||||
padding: 0; | |||||
} | |||||
#visualization { | |||||
box-sizing: border-box; | |||||
width: 100%; | |||||
height: 100%; | |||||
} | |||||
</style> | |||||
<!-- note: moment.js must be loaded before vis.js, else vis.js uses its embedded version of moment.js --> | |||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.3.1/moment.min.js"></script> | |||||
<script src="../../vis.js"></script> | |||||
<title>Timeline | Dataset example</title> | |||||
<style> | |||||
body, html { | |||||
font-family: arial, sans-serif; | |||||
font-size: 11pt; | |||||
height: 100%; | |||||
margin: 0; | |||||
padding: 0; | |||||
} | |||||
#visualization { | |||||
box-sizing: border-box; | |||||
width: 100%; | |||||
height: 100%; | |||||
} | |||||
</style> | |||||
<!-- note: moment.js must be loaded before vis.js, else vis.js uses its embedded version of moment.js --> | |||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.3.1/moment.min.js"></script> | |||||
<script src="../../dist/vis.js"></script> | |||||
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||||
</head> | </head> | ||||
<body> | <body> | ||||
<div id="visualization"></div> | <div id="visualization"></div> | ||||
<script> | <script> | ||||
var now = moment().minutes(0).seconds(0).milliseconds(0); | |||||
// create a dataset with items | |||||
var items = new vis.DataSet({ | |||||
convert: { | |||||
start: 'Date', | |||||
end: 'Date' | |||||
} | |||||
}); | |||||
items.add([ | |||||
{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), | |||||
end: now.clone().add('days', 7), | |||||
orientation: 'top', | |||||
height: '100%', | |||||
showCurrentTime: true | |||||
}; | |||||
var timeline = new vis.Timeline(container, items, options); | |||||
var now = moment().minutes(0).seconds(0).milliseconds(0); | |||||
// create a dataset with items | |||||
var items = new vis.DataSet({ | |||||
convert: { | |||||
start: 'Date', | |||||
end: 'Date' | |||||
} | |||||
}); | |||||
items.add([ | |||||
{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), | |||||
end: now.clone().add('days', 7), | |||||
orientation: 'top', | |||||
height: '100%', | |||||
showCurrentTime: true | |||||
}; | |||||
var timeline = new vis.Timeline(container, items, options); | |||||
</script> | </script> | ||||
</body> | </body> |
@ -1,72 +1,74 @@ | |||||
<!DOCTYPE HTML> | <!DOCTYPE HTML> | ||||
<html> | <html> | ||||
<head> | <head> | ||||
<title>Timeline | HTML data</title> | |||||
<title>Timeline | HTML data</title> | |||||
<style> | |||||
body, html { | |||||
font-family: arial, sans-serif; | |||||
font-size: 11pt; | |||||
} | |||||
span { | |||||
color: red; | |||||
} | |||||
span.large { | |||||
font-size: 200%; | |||||
} | |||||
</style> | |||||
<style> | |||||
body, html { | |||||
font-family: arial, sans-serif; | |||||
font-size: 11pt; | |||||
} | |||||
span { | |||||
color: red; | |||||
} | |||||
span.large { | |||||
font-size: 200%; | |||||
} | |||||
</style> | |||||
<script src="../../dist/vis.js"></script> | |||||
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||||
<script src="../../vis.js"></script> | |||||
</head> | </head> | ||||
<body> | <body> | ||||
<p> | <p> | ||||
Load HTML contents in the Timeline | |||||
Load HTML contents in the Timeline | |||||
</p> | </p> | ||||
<div id="visualization"></div> | <div id="visualization"></div> | ||||
<script> | <script> | ||||
// create a couple of HTML items in various ways | |||||
// create a couple of HTML items in various ways | |||||
var item1 = document.createElement('div'); | |||||
item1.appendChild(document.createTextNode('item 1')); | |||||
var item1 = document.createElement('div'); | |||||
item1.appendChild(document.createTextNode('item 1')); | |||||
var item2 = document.createElement('div'); | |||||
item2.innerHTML = '<span>item 2</span>'; | |||||
var item2 = document.createElement('div'); | |||||
item2.innerHTML = '<span>item 2</span>'; | |||||
var item3 = document.createElement('div'); | |||||
var span3 = document.createElement('span'); | |||||
span3.className = 'large'; | |||||
span3.appendChild(document.createTextNode('item 3')); | |||||
item3.appendChild(span3); | |||||
var item3 = document.createElement('div'); | |||||
var span3 = document.createElement('span'); | |||||
span3.className = 'large'; | |||||
span3.appendChild(document.createTextNode('item 3')); | |||||
item3.appendChild(span3); | |||||
var item4 = 'item <span class="large">4</span>'; | |||||
var item4 = 'item <span class="large">4</span>'; | |||||
var item5 = document.createElement('div'); | |||||
item5.appendChild(document.createTextNode('item 5')); | |||||
item5.appendChild(document.createElement('br')); | |||||
var img5 = document.createElement('img'); | |||||
img5.src = 'img/attachment-icon.png'; | |||||
img5.style.width = '48px'; | |||||
img5.style.height = '48px'; | |||||
item5.appendChild(img5); | |||||
var item5 = document.createElement('div'); | |||||
item5.appendChild(document.createTextNode('item 5')); | |||||
item5.appendChild(document.createElement('br')); | |||||
var img5 = document.createElement('img'); | |||||
img5.src = 'img/attachment-icon.png'; | |||||
img5.style.width = '48px'; | |||||
img5.style.height = '48px'; | |||||
item5.appendChild(img5); | |||||
var item6 = 'item6<br><img src="img/comments-icon.png" style="width: 48px; height: 48px;">'; | |||||
var item6 = 'item6<br><img src="img/comments-icon.png" style="width: 48px; height: 48px;">'; | |||||
var item7 = 'item7<br><a href="http://visjs.org" target="_blank">click here</a>'; | |||||
var item7 = 'item7<br><a href="http://visjs.org" target="_blank">click here</a>'; | |||||
// create data and a Timeline | |||||
var container = document.getElementById('visualization'); | |||||
var items = [ | |||||
{id: 1, content: item1, start: '2013-04-20'}, | |||||
{id: 2, content: item2, start: '2013-04-14'}, | |||||
{id: 3, content: item3, start: '2013-04-18'}, | |||||
{id: 4, content: item4, start: '2013-04-16', end: '2013-04-19'}, | |||||
{id: 5, content: item5, start: '2013-04-25'}, | |||||
{id: 6, content: item6, start: '2013-04-27'}, | |||||
{id: 7, content: item7, start: '2013-04-21'} | |||||
]; | |||||
var options = {}; | |||||
var timeline = new vis.Timeline(container, items, options); | |||||
// create data and a Timeline | |||||
var container = document.getElementById('visualization'); | |||||
var items = [ | |||||
{id: 1, content: item1, start: '2013-04-20'}, | |||||
{id: 2, content: item2, start: '2013-04-14'}, | |||||
{id: 3, content: item3, start: '2013-04-18'}, | |||||
{id: 4, content: item4, start: '2013-04-16', end: '2013-04-19'}, | |||||
{id: 5, content: item5, start: '2013-04-25'}, | |||||
{id: 6, content: item6, start: '2013-04-27'}, | |||||
{id: 7, content: item7, start: '2013-04-21'} | |||||
]; | |||||
var options = {}; | |||||
var timeline = new vis.Timeline(container, items, options); | |||||
</script> | </script> | ||||
</body> | </body> | ||||
</html> | </html> |
@ -1,71 +1,72 @@ | |||||
<!DOCTYPE HTML> | <!DOCTYPE HTML> | ||||
<html> | <html> | ||||
<head> | <head> | ||||
<title>Timeline | Group example</title> | |||||
<title>Timeline | Group example</title> | |||||
<style> | |||||
body, html { | |||||
font-family: arial, sans-serif; | |||||
font-size: 11pt; | |||||
} | |||||
<style> | |||||
body, html { | |||||
font-family: arial, sans-serif; | |||||
font-size: 11pt; | |||||
} | |||||
#visualization { | |||||
box-sizing: border-box; | |||||
width: 100%; | |||||
height: 300px; | |||||
} | |||||
</style> | |||||
#visualization { | |||||
box-sizing: border-box; | |||||
width: 100%; | |||||
height: 300px; | |||||
} | |||||
</style> | |||||
<!-- note: moment.js must be loaded before vis.js, else vis.js uses its embedded version of moment.js --> | |||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.3.1/moment.min.js"></script> | |||||
<!-- note: moment.js must be loaded before vis.js, else vis.js uses its embedded version of moment.js --> | |||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.3.1/moment.min.js"></script> | |||||
<script src="../../vis.js"></script> | |||||
<script src="../../dist/vis.js"></script> | |||||
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||||
</head> | </head> | ||||
<body> | <body> | ||||
<p> | <p> | ||||
This example demonstrate using groups. Note that a DataSet is used for both | |||||
items and groups, allowing to dynamically add, update or remove both items | |||||
and groups via the DataSet. | |||||
This example demonstrate using groups. Note that a DataSet is used for both | |||||
items and groups, allowing to dynamically add, update or remove both items | |||||
and groups via the DataSet. | |||||
</p> | </p> | ||||
<div id="visualization"></div> | <div id="visualization"></div> | ||||
<script> | <script> | ||||
var now = moment().minutes(0).seconds(0).milliseconds(0); | |||||
var groupCount = 3; | |||||
var itemCount = 20; | |||||
var now = moment().minutes(0).seconds(0).milliseconds(0); | |||||
var groupCount = 3; | |||||
var itemCount = 20; | |||||
// create a data set with groups | |||||
var names = ['John', 'Alston', 'Lee', 'Grant']; | |||||
var groups = new vis.DataSet(); | |||||
for (var g = 0; g < groupCount; g++) { | |||||
groups.add({id: g, content: names[g]}); | |||||
} | |||||
// create a data set with groups | |||||
var names = ['John', 'Alston', 'Lee', 'Grant']; | |||||
var groups = new vis.DataSet(); | |||||
for (var g = 0; g < groupCount; g++) { | |||||
groups.add({id: g, content: names[g]}); | |||||
} | |||||
// 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 + | |||||
' <span style="color:#97B0F8;">(' + names[group] + ')</span>', | |||||
start: start, | |||||
type: 'box' | |||||
}); | |||||
} | |||||
// 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 + | |||||
' <span style="color:#97B0F8;">(' + names[group] + ')</span>', | |||||
start: start, | |||||
type: 'box' | |||||
}); | |||||
} | |||||
// create visualization | |||||
var container = document.getElementById('visualization'); | |||||
var options = { | |||||
groupOrder: 'content' | |||||
}; | |||||
// create visualization | |||||
var container = document.getElementById('visualization'); | |||||
var options = { | |||||
groupOrder: 'content' | |||||
}; | |||||
var timeline = new vis.Timeline(container); | |||||
timeline.setOptions(options); | |||||
timeline.setGroups(groups); | |||||
timeline.setItems(items); | |||||
var timeline = new vis.Timeline(container); | |||||
timeline.setOptions(options); | |||||
timeline.setGroups(groups); | |||||
timeline.setItems(items); | |||||
</script> | </script> | ||||
</body> | </body> |
@ -1,11 +1,13 @@ | |||||
<!DOCTYPE HTML> | <!DOCTYPE HTML> | ||||
<html> | <html> | ||||
<head> | <head> | ||||
<title>Timeline requirejs demo</title> | |||||
<title>Timeline requirejs demo</title> | |||||
<script data-main="scripts/main" src="scripts/require.js"></script> | |||||
<script data-main="scripts/main" src="scripts/require.js"></script> | |||||
<link href="../../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||||
</head> | </head> | ||||
<body> | <body> | ||||
<div id="visualization"></div> | |||||
<div id="visualization"></div> | |||||
</body> | </body> | ||||
</html> | </html> |
@ -1,19 +1,19 @@ | |||||
require.config({ | require.config({ | ||||
paths: { | |||||
vis: '../../../../vis' | |||||
} | |||||
paths: { | |||||
vis: '../../../../dist/vis' | |||||
} | |||||
}); | }); | ||||
require(['vis'], function (vis) { | require(['vis'], function (vis) { | ||||
var container = document.getElementById('visualization'); | |||||
var data = [ | |||||
{id: 1, content: 'item 1', start: '2013-04-20'}, | |||||
{id: 2, content: 'item 2', start: '2013-04-14'}, | |||||
{id: 3, content: 'item 3', start: '2013-04-18'}, | |||||
{id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'}, | |||||
{id: 5, content: 'item 5', start: '2013-04-25'}, | |||||
{id: 6, content: 'item 6', start: '2013-04-27'} | |||||
]; | |||||
var options = {}; | |||||
var timeline = new vis.Timeline(container, data, options); | |||||
var container = document.getElementById('visualization'); | |||||
var data = [ | |||||
{id: 1, content: 'item 1', start: '2013-04-20'}, | |||||
{id: 2, content: 'item 2', start: '2013-04-14'}, | |||||
{id: 3, content: 'item 3', start: '2013-04-18'}, | |||||
{id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19'}, | |||||
{id: 5, content: 'item 5', start: '2013-04-25'}, | |||||
{id: 6, content: 'item 6', start: '2013-04-27'} | |||||
]; | |||||
var options = {}; | |||||
var timeline = new vis.Timeline(container, data, options); | |||||
}); | }); |