(function($){$.jqplot.CanvasAxisLabelRenderer=function(options){this.angle=0;this.axis;this.show=!0;this.showLabel=!0;this.label='';this.fontFamily='"Trebuchet MS", Arial, Helvetica, sans-serif';this.fontSize='11pt';this.fontWeight='normal';this.fontStretch=1.0;this.textColor='#666666';this.enableFontSupport=!0;this.pt2px=null;this._elem;this._ctx;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null};$.extend(!0,this,options);if(options.angle==null&&this.axis!='xaxis'&&this.axis!='x2axis'){this.angle=-90}
var ropts={fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily};if(this.pt2px){ropts.pt2px=this.pt2px}
if(this.enableFontSupport){if($.jqplot.support_canvas_text()){this._textRenderer=new $.jqplot.CanvasFontRenderer(ropts)}
else{this._textRenderer=new $.jqplot.CanvasTextRenderer(ropts)}}
else{this._textRenderer=new $.jqplot.CanvasTextRenderer(ropts)}};$.jqplot.CanvasAxisLabelRenderer.prototype.init=function(options){$.extend(!0,this,options);this._textRenderer.init({fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily})};$.jqplot.CanvasAxisLabelRenderer.prototype.getWidth=function(ctx){if(this._elem){return this._elem.outerWidth(!0)}
else{var tr=this._textRenderer;var l=tr.getWidth(ctx);var h=tr.getHeight(ctx);var w=Math.abs(Math.sin(tr.angle)*h)+Math.abs(Math.cos(tr.angle)*l);return w}};$.jqplot.CanvasAxisLabelRenderer.prototype.getHeight=function(ctx){if(this._elem){return this._elem.outerHeight(!0)}
else{var tr=this._textRenderer;var l=tr.getWidth(ctx);var h=tr.getHeight(ctx);var w=Math.abs(Math.cos(tr.angle)*h)+Math.abs(Math.sin(tr.angle)*l);return w}};$.jqplot.CanvasAxisLabelRenderer.prototype.getAngleRad=function(){var a=this.angle*Math.PI/180;return a};$.jqplot.CanvasAxisLabelRenderer.prototype.draw=function(ctx,plot){if(this._elem){if($.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){window.G_vmlCanvasManager.uninitElement(this._elem.get(0))}
this._elem.emptyForce();this._elem=null}
var elem=plot.canvasManager.getCanvas();this._textRenderer.setText(this.label,ctx);var w=this.getWidth(ctx);var h=this.getHeight(ctx);elem.width=w;elem.height=h;elem.style.width=w;elem.style.height=h;elem=plot.canvasManager.initCanvas(elem);this._elem=$(elem);this._elem.css({position:'absolute'});this._elem.addClass('jqplot-'+this.axis+'-label');elem=null;return this._elem};$.jqplot.CanvasAxisLabelRenderer.prototype.pack=function(){this._textRenderer.draw(this._elem.get(0).getContext("2d"),this.label)}})(jQuery)