@ -0,0 +1,115 @@ | |||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |||
<html> | |||
<head> | |||
<title>Graph 3D Axis Ticks</title> | |||
<style> | |||
body {font: 10pt arial;} | |||
</style> | |||
<script type="text/javascript" src="../../dist/vis.js"></script> | |||
<script type="text/javascript"> | |||
var data = null; | |||
var graph = null; | |||
function custom(x, y) { | |||
return (-Math.sin(x/Math.PI) * Math.cos(y/Math.PI) * 10 + 10) * 1000; | |||
} | |||
// Called when the Visualization API is loaded. | |||
function drawVisualization() { | |||
var style = document.getElementById('style').value; | |||
var withValue = ['bar-color', 'bar-size', 'dot-size', 'dot-color'].indexOf(style) != -1; | |||
// Create and populate a data table. | |||
data = new vis.DataSet(); | |||
// create some nice looking data with sin/cos | |||
var steps = 5; // number of datapoints will be steps*steps | |||
var axisMax = 10; | |||
var axisStep = axisMax / steps; | |||
for (var x = 0; x <= axisMax; x+=axisStep) { | |||
for (var y = 0; y <= axisMax; y+=axisStep) { | |||
var z = custom(x,y); | |||
if (withValue) { | |||
var value = (y - x); | |||
data.add({x:x, y:y, z: z, style:value}); | |||
} | |||
else { | |||
data.add({x:x, y:y, z: z}); | |||
} | |||
} | |||
} | |||
// specify options | |||
var options = { | |||
width: '600px', | |||
height: '600px', | |||
style: style, | |||
showPerspective: true, | |||
showGrid: true, | |||
showShadow: false, | |||
// Option tooltip can be true, false, or a function returning a string with HTML contents | |||
//tooltip: true, | |||
tooltip: function (point) { | |||
// parameter point contains properties x, y, z | |||
return 'value: <b>' + point.z + '</b>'; | |||
}, | |||
xValueLabel: function(value) { | |||
return vis.moment().add(value, 'days').format('DD MMM'); | |||
}, | |||
yValueLabel: function(value) { | |||
return value * 10 + '%'; | |||
}, | |||
zValueLabel: function(value) { | |||
return value / 1000 + 'K'; | |||
}, | |||
keepAspectRatio: true, | |||
verticalRatio: 0.5 | |||
}; | |||
var camera = graph ? graph.getCameraPosition() : null; | |||
// create our graph | |||
var container = document.getElementById('mygraph'); | |||
graph = new vis.Graph3d(container, data, options); | |||
if (camera) graph.setCameraPosition(camera); // restore camera position | |||
document.getElementById('style').onchange = drawVisualization; | |||
} | |||
</script> | |||
</head> | |||
<body onload="drawVisualization()"> | |||
<p> | |||
<label for="style"> Style: | |||
<select id="style"> | |||
<option value="bar">bar</option> | |||
<option value="bar-color">bar-color</option> | |||
<option value="bar-size">bar-size</option> | |||
<option value="dot">dot</option> | |||
<option value="dot-line">dot-line</option> | |||
<option value="dot-color">dot-color</option> | |||
<option value="dot-size">dot-size</option> | |||
<option value="grid">grid</option> | |||
<option value="line">line</option> | |||
<option value="surface">surface</option> | |||
</select> | |||
</label> | |||
</p> | |||
<div id="mygraph"></div> | |||
<div id="info"></div> | |||
</body> | |||
</html> |
@ -0,0 +1,43 @@ | |||
<!DOCTYPE HTML> | |||
<html> | |||
<head> | |||
<title>Timeline | Basic demo</title> | |||
<style type="text/css"> | |||
body, html { | |||
font-family: sans-serif; | |||
} | |||
</style> | |||
<script src="../../dist/vis.js"></script> | |||
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||
</head> | |||
<body> | |||
<p> | |||
In this example all items get HTML attributes attached: each item gets <code>data-?</code> attributes for each field defined on the JS object. | |||
</p> | |||
<div id="visualization"></div> | |||
<script type="text/javascript"> | |||
// DOM element where the Timeline will be attached | |||
var container = document.getElementById('visualization'); | |||
// Create a DataSet (allows two way data-binding) | |||
var items = new vis.DataSet([ | |||
{id: 1, content: 'item 1', start: '2014-04-20', tooltip: 'This is item 1'}, | |||
{id: 2, content: 'item 2', start: '2014-04-14'}, | |||
{id: 3, content: 'item 3', start: '2014-04-18'}, | |||
{id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-19'}, | |||
{id: 5, content: 'item 5', start: '2014-04-25'}, | |||
{id: 6, content: 'item 6', start: '2014-04-27', type: 'point', tooltip: 'This is item 6'} | |||
]); | |||
// Configuration for the Timeline | |||
var options = {dataAttributes: 'all'}; | |||
// Create a Timeline | |||
var timeline = new vis.Timeline(container, items, options); | |||
</script> | |||
</body> | |||
</html> |
@ -0,0 +1,52 @@ | |||
<!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.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> | |||
var items = new vis.DataSet([ | |||
{id: 'A', content: 'Period A', start: '2014-01-16', end: '2014-01-22', type: 'background'}, | |||
{id: 'B', content: 'Period B', start: '2014-01-25', end: '2014-01-30', type: 'background', className: 'negative'}, | |||
{id: 1, content: 'item 1<br>start', start: '2014-01-23'}, | |||
{id: 2, content: 'item 2', start: '2014-01-18'}, | |||
{id: 3, content: 'item 3', start: '2014-01-21'}, | |||
{id: 4, content: 'item 4', start: '2014-01-19', end: '2014-01-24'}, | |||
{id: 5, content: 'item 5', start: '2014-01-28', type:'point'}, | |||
{id: 6, content: 'item 6', start: '2014-01-26'} | |||
]); | |||
var container = document.getElementById('visualization'); | |||
var options = { | |||
start: '2014-01-10', | |||
end: '2014-02-10', | |||
editable: true | |||
}; | |||
var timeline = new vis.Timeline(container, items, options); | |||
</script> | |||
</body> | |||
</html> |
@ -0,0 +1,250 @@ | |||
<!DOCTYPE HTML> | |||
<html> | |||
<head> | |||
<title>Timeline | Templates</title> | |||
<!-- load handlebars for templating, and create a template --> | |||
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0-alpha.4/handlebars.min.js"></script> | |||
<script id="item-template" type="text/x-handlebars-template"> | |||
<table class="score"> | |||
<tr> | |||
<td colspan="3" class="description">{{description}}</td> | |||
</tr> | |||
<tr> | |||
<td>{{player1}}</td> | |||
<th>{{score1}} - {{score2}}</th> | |||
<td>{{player2}}</td> | |||
</tr> | |||
<tr> | |||
<td><img src="http://flagpedia.net/data/flags/mini/{{abbr1}}.png" width="31" height="20" alt="{{abbr1}}"></td> | |||
<th></th> | |||
<td><img src="http://flagpedia.net/data/flags/mini/{{abbr2}}.png" width="31" height="20" alt="{{abbr2}}"></td> | |||
</tr> | |||
</table> | |||
</script> | |||
<script src="../../dist/vis.js"></script> | |||
<link href="../../dist/vis.css" rel="stylesheet" type="text/css" /> | |||
<style type="text/css"> | |||
body, html { | |||
font-family: sans-serif; | |||
font-size: 10pt; | |||
} | |||
.vis.timeline .item { | |||
border-color: #acacac; | |||
background-color: #efefef; | |||
box-shadow: 5px 5px 10px rgba(128,128,128, 0.3); | |||
} | |||
table .description { | |||
font-style: italic; | |||
} | |||
#visualization { | |||
position: relative; | |||
overflow: hidden; | |||
} | |||
.logo { | |||
position: absolute; | |||
right: 10px; | |||
top: 10px; | |||
} | |||
.logo img { | |||
width: 120px; | |||
} | |||
</style> | |||
</head> | |||
<body> | |||
<h1>WK 2014</h1> | |||
<p style="max-width: 600px;"> | |||
This example demonstrates using templates to format item contents. In this case <a href="http://handlebarsjs.com">handlebars</a> is used as template engine, but you can just use your favorite template engine or manually craft HTML from the data of an item. | |||
</p> | |||
<div id="visualization"> | |||
<div class="logo"><img src="http://upload.wikimedia.org/wikipedia/en/e/e8/WC-2014-Brasil.svg"></div> | |||
</div> | |||
<script type="text/javascript"> | |||
// create a handlebars template | |||
var source = document.getElementById('item-template').innerHTML; | |||
var template = Handlebars.compile(document.getElementById('item-template').innerHTML); | |||
// DOM element where the Timeline will be attached | |||
var container = document.getElementById('visualization'); | |||
// Create a DataSet (allows two way data-binding) | |||
var items = new vis.DataSet([ | |||
// round of 16 | |||
{ | |||
player1: 'Brazil', | |||
abbr1: 'br', | |||
score1: '1 (3)', | |||
player2: 'Chile', | |||
abbr2: 'cl', | |||
score2: '1 (2)', | |||
description: 'round of 16', | |||
start: '2014-06-28 13:00' | |||
}, | |||
{ | |||
player1: 'Colombia', | |||
abbr1: 'co', | |||
score1: 2, | |||
player2: 'Uruguay', | |||
abbr2: 'uy', | |||
score2: 0, | |||
description: 'round of 16', | |||
start: '2014-06-28 17:00' | |||
}, | |||
{ | |||
player1: 'Netherlands', | |||
abbr1: 'nl', | |||
score1: 2, | |||
player2: 'Mexico', | |||
abbr2: 'mx', | |||
score2: 1, | |||
description: 'round of 16', | |||
start: '2014-06-29 13:00' | |||
}, | |||
{ | |||
player1: 'Costa Rica', | |||
abbr1: 'cr', | |||
score1: '1 (5)', | |||
player2: 'Greece', | |||
abbr2: 'gr', | |||
score2: '1 (3)', | |||
description: 'round of 16', | |||
start: '2014-06-29 17:00' | |||
}, | |||
{ | |||
player1: 'France', | |||
abbr1: 'fr', | |||
score1: 2, | |||
player2: 'Nigeria', | |||
abbr2: 'ng', | |||
score2: 0, | |||
description: 'round of 16', | |||
start: '2014-06-30 13:00' | |||
}, | |||
{ | |||
player1: 'Germany', | |||
abbr1: 'de', | |||
score1: 2, | |||
player2: 'Algeria', | |||
abbr2: 'dz', | |||
score2: 1, | |||
description: 'round of 16', | |||
start: '2014-06-30 17:00' | |||
}, | |||
{ | |||
player1: 'Argentina', | |||
abbr1: 'ar', | |||
score1: 1, | |||
player2: 'Switzerland', | |||
abbr2: 'ch', | |||
score2: 0, | |||
description: 'round of 16', | |||
start: '2014-07-01 13:00' | |||
}, | |||
{ | |||
player1: 'Belgium', | |||
abbr1: 'be', | |||
score1: 2, | |||
player2: 'USA', | |||
abbr2: 'us', | |||
score2: 1, | |||
description: 'round of 16', | |||
start: '2014-07-01 17:00' | |||
}, | |||
// quarter-finals | |||
{ | |||
player1: 'France', | |||
abbr1: 'fr', | |||
score1: 0, | |||
player2: 'Germany', | |||
abbr2: 'de', | |||
score2: 1, | |||
description: 'quarter-finals', | |||
start: '2014-07-04 13:00' | |||
}, | |||
{ | |||
player1: 'Brazil', | |||
abbr1: 'br', | |||
score1: 2, | |||
player2: 'Colombia', | |||
abbr2: 'co', | |||
score2: 1, | |||
description: 'quarter-finals', | |||
start: '2014-07-04 17:00' | |||
}, | |||
{ | |||
player1: 'Argentina', | |||
abbr1: 'ar', | |||
score1: 1, | |||
player2: 'Belgium', | |||
abbr2: 'be', | |||
score2: 0, | |||
description: 'quarter-finals', | |||
start: '2014-07-05 13:00' | |||
}, | |||
{ | |||
player1: 'Netherlands', | |||
abbr1: 'nl', | |||
score1: '0 (4)', | |||
player2: 'Costa Rica', | |||
abbr2: 'cr', | |||
score2: '0 (3)', | |||
description: 'quarter-finals', | |||
start: '2014-07-05 17:00' | |||
}, | |||
// semi-finals | |||
{ | |||
player1: 'Brazil', | |||
abbr1: 'br', | |||
score1: 1, | |||
player2: 'Germany', | |||
abbr2: 'de', | |||
score2: 7, | |||
description: 'semi-finals', | |||
start: '2014-07-08 17:00' | |||
}, | |||
{ | |||
player1: 'Netherlands', | |||
abbr1: 'nl', | |||
score1: '0 (2)', | |||
player2: 'Argentina', | |||
abbr2: 'ar', | |||
score2: '0 (4)', | |||
description: 'semi-finals', | |||
start: '2014-07-09 17:00' | |||
}, | |||
// final | |||
{ | |||
player1: 'Germany', | |||
score1: 1, | |||
abbr1: 'de', | |||
player2: 'Argentina', | |||
abbr2: 'ar', | |||
score2: 0, | |||
description: 'final', | |||
start: '2014-07-13 16:00' | |||
} | |||
]); | |||
// Configuration for the Timeline | |||
var options = { | |||
// specify a template for the items | |||
template: template | |||
}; | |||
// Create a Timeline | |||
var timeline = new vis.Timeline(container, items, options); | |||
</script> | |||
</body> | |||
</html> |
@ -0,0 +1,50 @@ | |||
<!DOCTYPE HTML> | |||
<html> | |||
<head> | |||
<title>Timeline | Hiding times demo</title> | |||
<style type="text/css"> | |||
body, html { | |||
font-family: sans-serif; | |||
} | |||
</style> | |||
<script src="../../dist/vis.js"></script> | |||
<link href="../../dist/vis.css" rel="stylesheet" type="text/css"/> | |||
</head> | |||
<body> | |||
<div id="visualization"></div> | |||
<script type="text/javascript"> | |||
// DOM element where the Timeline will be attached | |||
var container = document.getElementById('visualization'); | |||
// Create a DataSet (allows two way data-binding) | |||
var items = new vis.DataSet([ | |||
{id: 1, content: 'item 1', start: '2014-04-19'}, | |||
{id: 2, content: 'item 2', start: '2014-04-21'}, | |||
{id: 3, content: 'item 3', start: '2014-04-18'}, | |||
{id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-24'}, | |||
{id: 5, content: 'item 5', start: '2014-04-26 12:00:00'}, | |||
{id: 6, content: 'item 6', start: '2014-04-27', type: 'point'} | |||
]); | |||
// Configuration for the Timeline | |||
var options = { | |||
hiddenDates: [ | |||
{start: '2014-03-21 00:00:00', end: '2014-03-28 00:00:00'}, | |||
{start: '2013-03-29 00:00:00', end: '2013-03-31 00:00:00', repeat: 'weekly'}, // daily weekly monthly yearly | |||
{start: '2013-03-29 20:00:00', end: '2013-03-31 9:00:00', repeat: 'daily'} // daily weekly monthly yearly | |||
], | |||
start: '2014-04-17', | |||
end: '2014-05-01', | |||
height: '200px', | |||
editable: true, | |||
showCustomTime: true | |||
}; | |||
// Create a Timeline | |||
var timeline = new vis.Timeline(container, items, options); | |||
timeline.setCustomTime("2014-04-18 13:00:00"); | |||
</script> | |||
</body> | |||
</html> |
@ -0,0 +1,73 @@ | |||
<!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> |
@ -0,0 +1,56 @@ | |||
<!DOCTYPE HTML> | |||
<html> | |||
<head> | |||
<title>Timeline | Background areas with groups</title> | |||
<style> | |||
body, html { | |||
font-family: arial, sans-serif; | |||
font-size: 11pt; | |||
} | |||
</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" when using groups.</p> | |||
<ul> | |||
<li>Background items having a group are displayed in that group</li> | |||
<li>Background items without a group are spread over the whole timeline</li> | |||
<li>Background items with a non-existing group are not displayed</li> | |||
</ul> | |||
<div id="visualization"></div> | |||
<script> | |||
var items = new vis.DataSet([ | |||
{id: 'A', content: 'Period A', start: '2014-01-16', end: '2014-01-22', type: 'background', group: 1}, | |||
{id: 'B', content: 'Period B', start: '2014-01-23', end: '2014-01-26', type: 'background', group: 2}, | |||
{id: 'C', content: 'Period C', start: '2014-01-27', end: '2014-02-03', type: 'background'}, // no group | |||
{id: 'D', content: 'Period D', start: '2014-01-14', end: '2014-01-20', type: 'background', group: 'non-existing'}, | |||
{id: 1, content: 'item 1<br>start', start: '2014-01-30', group: 1}, | |||
{id: 2, content: 'item 2', start: '2014-01-18', group: 1}, | |||
{id: 3, content: 'item 3', start: '2014-01-21', group: 2}, | |||
{id: 4, content: 'item 4', start: '2014-01-17', end: '2014-01-21', group: 2}, | |||
{id: 5, content: 'item 5', start: '2014-01-28', type:'point', group: 2}, | |||
{id: 6, content: 'item 6', start: '2014-01-25', group: 2} | |||
]); | |||
var groups = new vis.DataSet([ | |||
{id: 1, content: 'Group 1'}, | |||
{id: 2, content: 'Group 2'} | |||
]); | |||
var container = document.getElementById('visualization'); | |||
var options = { | |||
start: '2014-01-10', | |||
end: '2014-02-10', | |||
editable: true | |||
}; | |||
var timeline = new vis.Timeline(container, items, groups, options); | |||
</script> | |||
</body> | |||
</html> |