|
@ -18,11 +18,18 @@ var ItemSet = require('./component/ItemSet'); |
|
|
* @constructor |
|
|
* @constructor |
|
|
* @extends Core |
|
|
* @extends Core |
|
|
*/ |
|
|
*/ |
|
|
function Timeline (container, items, options) { |
|
|
|
|
|
|
|
|
function Timeline (container, items, groups, options) { |
|
|
if (!(this instanceof Timeline)) { |
|
|
if (!(this instanceof Timeline)) { |
|
|
throw new SyntaxError('Constructor must be called with the new operator'); |
|
|
throw new SyntaxError('Constructor must be called with the new operator'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if the third element is options, the forth is groups (optionally);
|
|
|
|
|
|
if (!(groups instanceof Array || groups instanceof vis.DataSet) && groups instanceof Object) { |
|
|
|
|
|
var forthArgument = options; |
|
|
|
|
|
options = groups; |
|
|
|
|
|
groups = forthArgument; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var me = this; |
|
|
var me = this; |
|
|
this.defaultOptions = { |
|
|
this.defaultOptions = { |
|
|
start: null, |
|
|
start: null, |
|
@ -92,6 +99,11 @@ function Timeline (container, items, options) { |
|
|
this.setOptions(options); |
|
|
this.setOptions(options); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// IMPORTANT: THIS HAPPENS BEFORE SET ITEMS!
|
|
|
|
|
|
if (groups) { |
|
|
|
|
|
this.setGroups(groups); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// create itemset
|
|
|
// create itemset
|
|
|
if (items) { |
|
|
if (items) { |
|
|
this.setItems(items); |
|
|
this.setItems(items); |
|
|