|
|
@ -9,8 +9,10 @@ var TimeAxis = require('./component/TimeAxis'); |
|
|
|
var CurrentTime = require('./component/CurrentTime'); |
|
|
|
var CustomTime = require('./component/CustomTime'); |
|
|
|
var ItemSet = require('./component/ItemSet'); |
|
|
|
var ConfigurationSystem = require('../network/modules/ConfigurationSystem'); |
|
|
|
|
|
|
|
var ConfigurationSystem = require('../network/modules/ConfigurationSystem'); |
|
|
|
var Validator = require('../network/modules/Validator').default; |
|
|
|
var printStyle = require('../network/modules/Validator').printStyle; |
|
|
|
var allOptions = require('./options').allOptions; |
|
|
|
var configureOptions = require('./options').configureOptions; |
|
|
|
|
|
|
@ -151,6 +153,13 @@ Timeline.prototype.redraw = function() { |
|
|
|
}; |
|
|
|
|
|
|
|
Timeline.prototype.setOptions = function (options) { |
|
|
|
// validate options
|
|
|
|
let errorFound = Validator.validate(options, allOptions); |
|
|
|
if (errorFound === true) { |
|
|
|
options = {}; |
|
|
|
console.log('%cErrors have been found in the supplied options object. None of the options will be used.', printStyle); |
|
|
|
} |
|
|
|
|
|
|
|
Core.prototype.setOptions.call(this, options); |
|
|
|
|
|
|
|
if ('type' in options) { |
|
|
@ -159,8 +168,10 @@ Timeline.prototype.setOptions = function (options) { |
|
|
|
|
|
|
|
// force recreation of all items
|
|
|
|
var itemsData = this.itemsData; |
|
|
|
this.setItems(null); // remove all
|
|
|
|
this.setItems(itemsData); // add all
|
|
|
|
if (itemsData) { |
|
|
|
this.setItems(null); // remove all
|
|
|
|
this.setItems(itemsData); // add all
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
@ -339,9 +350,9 @@ Timeline.prototype.focus = function(id, options) { |
|
|
|
*/ |
|
|
|
Timeline.prototype.getItemRange = function() { |
|
|
|
// calculate min from start filed
|
|
|
|
var dataset = this.itemsData.getDataSet(), |
|
|
|
min = null, |
|
|
|
max = null; |
|
|
|
var dataset = this.itemsData && this.itemsData.getDataSet(); |
|
|
|
var min = null; |
|
|
|
var max = null; |
|
|
|
|
|
|
|
if (dataset) { |
|
|
|
// calculate the minimum value of the field 'start'
|
|
|
|