Browse Source

Changed to `moment().add(value, unit)` notation

v3_develop
jos 10 years ago
parent
commit
6b61e95bf2
4 changed files with 17 additions and 17 deletions
  1. +2
    -2
      examples/timeline/03_performance.html
  2. +1
    -1
      examples/timeline/05_groups.html
  3. +2
    -2
      lib/timeline/Range.js
  4. +12
    -12
      test/timeline.html

+ 2
- 2
examples/timeline/03_performance.html View File

@ -52,8 +52,8 @@
var container = document.getElementById('visualization');
var options = {
editable: true,
start: now.clone().add('days', -3),
end: now.clone().add('days', 11),
start: now.clone().add(-3, 'days'),
end: now.clone().add(11, 'days'),
zoomMin: 1000 * 60 * 60 * 24, // a day
zoomMax: 1000 * 60 * 60 * 24 * 30 * 3 // three months
//maxHeight: 300,

+ 1
- 1
examples/timeline/05_groups.html View File

@ -45,7 +45,7 @@
// 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 start = now.clone().add(Math.random() * 200, 'hours');
var group = Math.floor(Math.random() * groupCount);
items.add({
id: i,

+ 2
- 2
lib/timeline/Range.js View File

@ -13,8 +13,8 @@ var Component = require('./component/Component');
*/
function Range(body, options) {
var now = moment().hours(0).minutes(0).seconds(0).milliseconds(0);
this.start = now.clone().add('days', -3).valueOf(); // Number
this.end = now.clone().add('days', 4).valueOf(); // Number
this.start = now.clone().add(-3, 'days').valueOf(); // Number
this.end = now.clone().add(4, 'days').valueOf(); // Number
this.body = body;

+ 12
- 12
test/timeline.html View File

@ -5,9 +5,9 @@
<script src="../node_modules/moment/moment.js"></script>
<script src="../node_modules/moment/locale/nl.js"></script>
<script>
moment.lang('nl');
moment.locale('nl');
</script>
<script src="../vis-custom.js"></script>
<script src="../dist/vis.js"></script>
<link href="../dist/vis.css" rel="stylesheet" type="text/css" />
<style type="text/css">
@ -69,26 +69,26 @@
fieldId: '_id'
});
items.add([
{_id: 0, content: 'item 0', start: now.clone().add('days', 3).toDate(), title: 'hello title!'},
{_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: 0, content: 'item 0', start: now.clone().add(3, 'days').toDate(), title: 'hello title!'},
{_id: '1', content: 'item 1<br>start', start: now.clone().add(4, 'days').toDate()},
{_id: 2, content: 'item 2', start: now.clone().add(-2, 'days').toDate() },
{_id: 3, content: 'item 3', start: now.clone().add(2, 'days').toDate()},
{
_id: 4, content: 'item 4 ',
start: now.clone().add('days', 0).toDate(),
end: now.clone().add('days', 7).toDate(),
start: now.clone().add(0, 'days').toDate(),
end: now.clone().add(7, 'days').toDate(),
title: 'hello title!'
},
{_id: 5, content: 'item 5', start: now.clone().add('days', 9).toDate(), type:'point', title: 'hello title!'},
{_id: 6, content: 'item 6', start: now.clone().add('days', 11).toDate()}
{_id: 5, content: 'item 5', start: now.clone().add(9, 'days').toDate(), type:'point', title: 'hello title!'},
{_id: 6, content: 'item 6', start: now.clone().add(11, 'days').toDate()}
]);
var container = document.getElementById('visualization');
var options = {
editable: true,
//orientation: 'top',
start: now.clone().add('days', -7),
end: now.clone().add('days', 7),
start: now.clone().add(-7, 'days'),
end: now.clone().add(7, 'days'),
//maxHeight: 200,
//height: 200,
showCurrentTime: true,

Loading…
Cancel
Save