in web/servicemix-web-console/src/main/webapp/js/plotkit/Canvas.js [75:161]
PlotKit.CanvasRenderer.prototype.__init__ = function(element, layout, options) {
var isNil = MochiKit.Base.isUndefinedOrNull;
var Color = MochiKit.Color.Color;
// default options
this.options = {
"drawBackground": true,
"backgroundColor": Color.whiteColor(),
"padding": {left: 30, right: 30, top: 5, bottom: 10},
"colorScheme": PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),
"strokeColor": Color.whiteColor(),
"strokeColorTransform": "asStrokeColor",
"strokeWidth": 0.5,
"shouldFill": true,
"shouldStroke": true,
"drawXAxis": true,
"drawYAxis": true,
"axisLineColor": Color.blackColor(),
"axisLineWidth": 0.5,
"axisTickSize": 3,
"axisLabelColor": Color.blackColor(),
"axisLabelFont": "Arial",
"axisLabelFontSize": 9,
"axisLabelWidth": 50,
"pieRadius": 0.4,
"enableEvents": true,
"IECanvasHTC": "PlotKit/iecanvas.htc"
};
MochiKit.Base.update(this.options, options ? options : {});
// we need to refetch the element because of this horrible Canvas on IE
// crap
this.element_id = element.id ? element.id : element;
// Stuff relating to Canvas on IE support
var self = PlotKit.CanvasRenderer;
this.isIE = self.IECanvasEmulationIfNeeded(this.options.IECanvasHTC);
this.IEDelay = 0.5;
this.maxTries = 5;
this.renderDelay = null;
this.clearDelay = null;
this.layout = layout;
this.style = layout.style;
this.element = MochiKit.DOM.getElement(this.element_id);
//this.element = element;
this.container = this.element.parentNode;
this.height = this.element.height;
this.width = this.element.width;
// --- check whether everything is ok before we return
if (isNil(this.element))
throw "CanvasRenderer() - passed canvas is not found";
if (!this.isIE && !(PlotKit.CanvasRenderer.isSupported(this.element)))
throw "CanvasRenderer() - Canvas is not supported.";
if (isNil(this.container) || (this.container.nodeName.toLowerCase() != "div"))
throw "CanvasRenderer() - <canvas> needs to be enclosed in <div>";
// internal state
this.xlabels = new Array();
this.ylabels = new Array();
this.isFirstRender = true;
this.area = {
x: this.options.padding.left,
y: this.options.padding.top,
w: this.width - this.options.padding.left - this.options.padding.right,
h: this.height - this.options.padding.top - this.options.padding.bottom
};
MochiKit.DOM.updateNodeAttributes(this.container,
{"style":{ "position": "relative", "width": this.width + "px"}});
// load event system if we have Signals
try {
this.event_isinside = null;
if (MochiKit.Signal && this.options.enableEvents) {
this._initialiseEvents();
}
}
catch (e) {
// still experimental
}
};