cacert-testmgr/external/ZendFramework-1.9.5/externals/dojo/dojox/charting/plot2d/Base.js

103 lines
2.4 KiB
JavaScript
Raw Normal View History

dojo.provide("dojox.charting.plot2d.Base");
dojo.require("dojox.charting.scaler.primitive");
dojo.require("dojox.charting.Element");
dojo.require("dojox.charting.plot2d.common");
dojo.declare("dojox.charting.plot2d.Base", dojox.charting.Element, {
destroy: function(){
this.resetEvents();
this.inherited(arguments);
},
clear: function(){
this.series = [];
this._hAxis = null;
this._vAxis = null;
this.dirty = true;
return this;
},
setAxis: function(axis){
if(axis){
this[axis.vertical ? "_vAxis" : "_hAxis"] = axis;
}
return this;
},
addSeries: function(run){
this.series.push(run);
return this;
},
calculateAxes: function(dim){
return this;
},
isDirty: function(){
return this.dirty || this._hAxis && this._hAxis.dirty || this._vAxis && this._vAxis.dirty;
},
render: function(dim, offsets){
return this;
},
getRequiredColors: function(){
return this.series.length;
},
// events
plotEvent: function(o){
// intentionally empty --- used for events
},
connect: function(object, method){
this.dirty = true;
return dojo.connect(this, "plotEvent", object, method);
},
events: function(){
var ls = this.plotEvent._listeners;
if(!ls || !ls.length){ return false; }
for(var i in ls){
if(!(i in Array.prototype)){
return true;
}
}
return false;
},
resetEvents: function(){
this.plotEvent({type: "onplotreset", plot: this});
},
// utilities
_calc: function(dim, stats){
// calculate scaler
if(this._hAxis){
if(!this._hAxis.initialized()){
this._hAxis.calculate(stats.hmin, stats.hmax, dim.width);
}
this._hScaler = this._hAxis.getScaler();
}else{
this._hScaler = dojox.charting.scaler.primitive.buildScaler(stats.hmin, stats.hmax, dim.width);
}
if(this._vAxis){
if(!this._vAxis.initialized()){
this._vAxis.calculate(stats.vmin, stats.vmax, dim.height);
}
this._vScaler = this._vAxis.getScaler();
}else{
this._vScaler = dojox.charting.scaler.primitive.buildScaler(stats.vmin, stats.vmax, dim.height);
}
},
_connectEvents: function(shape, o){
shape.connect("onmouseover", this, function(e){
o.type = "onmouseover";
o.event = e;
this.plotEvent(o);
});
shape.connect("onmouseout", this, function(e){
o.type = "onmouseout";
o.event = e;
this.plotEvent(o);
});
shape.connect("onclick", this, function(e){
o.type = "onclick";
o.event = e;
this.plotEvent(o);
});
}
});