|
|
@ -18,11 +18,18 @@ var ItemSet = require('./component/ItemSet'); |
|
|
|
* @constructor |
|
|
|
* @extends Core |
|
|
|
*/ |
|
|
|
function Timeline (container, items, options) { |
|
|
|
function Timeline (container, items, groups, options) { |
|
|
|
if (!(this instanceof Timeline)) { |
|
|
|
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; |
|
|
|
this.defaultOptions = { |
|
|
|
start: null, |
|
|
@ -92,6 +99,11 @@ function Timeline (container, items, options) { |
|
|
|
this.setOptions(options); |
|
|
|
} |
|
|
|
|
|
|
|
// IMPORTANT: THIS HAPPENS BEFORE SET ITEMS!
|
|
|
|
if (groups) { |
|
|
|
this.setGroups(groups); |
|
|
|
} |
|
|
|
|
|
|
|
// create itemset
|
|
|
|
if (items) { |
|
|
|
this.setItems(items); |
|
|
|