added setOptions method to provider.json #21

This commit is contained in:
javi 2013-11-18 17:30:13 +01:00
parent 9fac885679
commit c72fd4690f

View File

@ -335,6 +335,36 @@
setColumn: function(column, isTime) {
this.options.column = column;
this.options.is_time = isTime === undefined ? true: false;
this.reload();
},
setResolution: function(res) {
this.options.resolution = res;
},
setOptions: function(opt) {
var refresh = false;
if(opt.resolution !== undefined && opt.resolution !== this.options.resolution) {
this.options.resolution = opt.resolution;
refresh = true;
}
if(opt.steps !== undefined && opt.steps !== this.options.steps) {
this.setSteps(opt.steps, { silent: true });
refresh = true;
}
if(opt.column !== undefined && opt.column !== this.options.column) {
this.options.column = opt.column;
refresh = true;
}
if (refresh) this.reload();
},
reload: function() {
this._ready = false;
this._fetchKeySpan();
},
@ -342,8 +372,7 @@
setSQL: function(sql) {
if (this.options.sql != sql) {
this.options.sql = sql;
this._ready = false;
this._fetchKeySpan();
this.options.reload();
}
},
@ -351,13 +380,13 @@
return Math.min(this.options.steps, this.options.data_steps);
},
setSteps: function(steps) {
setSteps: function(steps, opt) {
opt = opt || {}
if (this.options.steps !== steps) {
this.options.steps = steps;
this.options.step = (this.options.end - this.options.start)/this.getSteps();
this.options.step = this.options.step || 1;
this._ready = false;
this._fetchKeySpan();
if (!opt.silent) this.reload()
}
},