Browse Source

updated constructors for timeline and graph2d (container, items, groups, options) with backwards compatibility

v3_develop
Alex de Mulder 10 years ago
parent
commit
4221671f55
3 changed files with 1958 additions and 1920 deletions
  1. +1937
    -1918
      dist/vis.js
  2. +8
    -1
      lib/timeline/Graph2d.js
  3. +13
    -1
      lib/timeline/Timeline.js

+ 1937
- 1918
dist/vis.js
File diff suppressed because it is too large
View File


+ 8
- 1
lib/timeline/Graph2d.js View File

@ -18,7 +18,14 @@ var LineGraph = require('./component/LineGraph');
* @constructor
* @extends Core
*/
function Graph2d (container, items, options, groups) {
function Graph2d (container, items, groups, options) {
// 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,

+ 13
- 1
lib/timeline/Timeline.js View File

@ -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);

Loading…
Cancel
Save