|
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Timeline | Light bundle</title>
|
|
|
|
<style type="text/css">
|
|
body, html {
|
|
font-family: arial;
|
|
}
|
|
p {
|
|
max-width: 600px;
|
|
}
|
|
</style>
|
|
|
|
<!--
|
|
load external libraries
|
|
-->
|
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.7.0/moment.min.js"></script>
|
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/hammer.js/1.0.5/hammer.min.js"></script>
|
|
|
|
<script src="../../dist/vis-light.min.js"></script>
|
|
<link href="../../dist/vis.min.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
|
|
<p>
|
|
The light bundle of vis.js (<code>vis-light.js</code> or <code>vis-light.min.js</code>) don't have the external dependencies of moment.js and hammer.js bundled. You have to load these yourself before loading vis-light.js. This is useful in the case that your application is using moment.js and/or hammer.js itself too, in order not to load these libraries twice. Note that it is possible too to create your own vis.js bundle: the source code consists of common.js modules which is browserifiable.
|
|
</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'},
|
|
{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'}
|
|
]);
|
|
|
|
// Configuration for the Timeline
|
|
var options = {
|
|
editable: true
|
|
};
|
|
|
|
// Create a Timeline
|
|
var timeline = new vis.Timeline(container, items, options);
|
|
</script>
|
|
</body>
|
|
</html>
|