bremen_short_url/BackEnd/assets/javascript/pages/jquery.flot.axislabels.min.js

3 lines
6.9 KiB
JavaScript

"use strict";!function(s){function r(){return!!document.createElement("canvas").getContext&&"function"==typeof document.createElement("canvas").getContext("2d").fillText}function p(){var t=document.createElement("div");return void 0!==t.style.MozTransition||void 0!==t.style.OTransition||void 0!==t.style.webkitTransition||void 0!==t.style.transition}function a(t,i,e,s,o){this.axisName=t,this.position=i,this.padding=e,this.plot=s,this.opts=o,this.width=0,this.height=0}function d(t,i,e,s,o){a.prototype.constructor.call(this,t,i,e,s,o)}function c(t,i,e,s,o){a.prototype.constructor.call(this,t,i,e,s,o),this.elem=null}function f(t,i,e,s,o){c.prototype.constructor.call(this,t,i,e,s,o)}function b(t,i,e,s,o){f.prototype.constructor.call(this,t,i,e,s,o),this.requiresResize=!1}a.prototype.cleanup=function(){},((d.prototype=new a).constructor=d).prototype.calculateSize=function(){this.opts.axisLabelFontSizePixels||(this.opts.axisLabelFontSizePixels=14),this.opts.axisLabelFontFamily||(this.opts.axisLabelFontFamily="sans-serif");this.opts.axisLabelFontSizePixels,this.padding,this.opts.axisLabelFontSizePixels,this.padding;"left"==this.position||"right"==this.position?(this.width=this.opts.axisLabelFontSizePixels+this.padding,this.height=0):(this.width=0,this.height=this.opts.axisLabelFontSizePixels+this.padding)},d.prototype.draw=function(t){this.opts.axisLabelColour||(this.opts.axisLabelColour="black");var i=this.plot.getCanvas().getContext("2d");i.save(),i.font=this.opts.axisLabelFontSizePixels+"px "+this.opts.axisLabelFontFamily,i.fillStyle=this.opts.axisLabelColour;var e,s,o=i.measureText(this.opts.axisLabel).width,a=this.opts.axisLabelFontSizePixels,l=0;"top"==this.position?(e=t.left+t.width/2-o/2,s=t.top+.72*a):"bottom"==this.position?(e=t.left+t.width/2-o/2,s=t.top+t.height-.72*a):"left"==this.position?(e=t.left+.72*a,s=t.height/2+t.top+o/2,l=-Math.PI/2):"right"==this.position&&(e=t.left+t.width-.72*a,s=t.height/2+t.top-o/2,l=Math.PI/2),i.translate(e,s),i.rotate(l),i.fillText(this.opts.axisLabel,0,0),i.restore()},((c.prototype=new a).constructor=c).prototype.calculateSize=function(){var t=s('<div class="axisLabels" style="position:absolute;">'+this.opts.axisLabel+"</div>");this.plot.getPlaceholder().append(t),this.labelWidth=t.outerWidth(!0),this.labelHeight=t.outerHeight(!0),t.remove(),this.width=this.height=0,"left"==this.position||"right"==this.position?this.width=this.labelWidth+this.padding:this.height=this.labelHeight+this.padding},c.prototype.cleanup=function(){this.elem&&this.elem.remove()},c.prototype.draw=function(t){this.plot.getPlaceholder().find("#"+this.axisName+"Label").remove(),this.elem=s('<div id="'+this.axisName+'Label" " class="axisLabels" style="position:absolute;">'+this.opts.axisLabel+"</div>"),this.plot.getPlaceholder().append(this.elem),"top"==this.position?(this.elem.css("left",t.left+t.width/2-this.labelWidth/2+"px"),this.elem.css("top",t.top+"px")):"bottom"==this.position?(this.elem.css("left",t.left+t.width/2-this.labelWidth/2+"px"),this.elem.css("top",t.top+t.height-this.labelHeight+"px")):"left"==this.position?(this.elem.css("top",t.top+t.height/2-this.labelHeight/2+"px"),this.elem.css("left",t.left+"px")):"right"==this.position&&(this.elem.css("top",t.top+t.height/2-this.labelHeight/2+"px"),this.elem.css("left",t.left+t.width-this.labelWidth+"px"))},((f.prototype=new c).constructor=f).prototype.calculateSize=function(){c.prototype.calculateSize.call(this),this.width=this.height=0,"left"==this.position||"right"==this.position?this.width=this.labelHeight+this.padding:this.height=this.labelHeight+this.padding},f.prototype.transforms=function(t,i,e){var s={"-moz-transform":"","-webkit-transform":"","-o-transform":"","-ms-transform":""};if(0!=i||0!=e){var o=" translate("+i+"px, "+e+"px)";s["-moz-transform"]+=o,s["-webkit-transform"]+=o,s["-o-transform"]+=o,s["-ms-transform"]+=o}if(0!=t){var a=" rotate("+t+"deg)";s["-moz-transform"]+=a,s["-webkit-transform"]+=a,s["-o-transform"]+=a,s["-ms-transform"]+=a}var l="top: 0; left: 0; ";for(var h in s)s[h]&&(l+=h+":"+s[h]+";");return l+=";"},f.prototype.calculateOffsets=function(t){var i={x:0,y:0,degrees:0};return"bottom"==this.position?(i.x=t.left+t.width/2-this.labelWidth/2,i.y=t.top+t.height-this.labelHeight):"top"==this.position?(i.x=t.left+t.width/2-this.labelWidth/2,i.y=t.top):"left"==this.position?(i.degrees=-90,i.x=t.left-this.labelWidth/2+this.labelHeight/2,i.y=t.height/2+t.top):"right"==this.position&&(i.degrees=90,i.x=t.left+t.width-this.labelWidth/2-this.labelHeight/2,i.y=t.height/2+t.top),i.x=Math.round(i.x),i.y=Math.round(i.y),i},f.prototype.draw=function(t){this.plot.getPlaceholder().find("."+this.axisName+"Label").remove();var i=this.calculateOffsets(t);this.elem=s('<div class="axisLabels '+this.axisName+'Label" style="position:absolute; '+this.transforms(i.degrees,i.x,i.y)+'">'+this.opts.axisLabel+"</div>"),this.plot.getPlaceholder().append(this.elem)},((b.prototype=new f).constructor=b).prototype.transforms=function(t,i,e){var s="";if(0!=t){for(var o=t/90;o<0;)o+=4;s+=" filter: progid:DXImageTransform.Microsoft.BasicImage(rotation="+o+"); ",this.requiresResize="right"==this.position}return 0!=i&&(s+="left: "+i+"px; "),0!=e&&(s+="top: "+e+"px; "),s},b.prototype.calculateOffsets=function(t){var i=f.prototype.calculateOffsets.call(this,t);return"top"==this.position?i.y=t.top+1:"left"==this.position?(i.x=t.left,i.y=t.height/2+t.top-this.labelWidth/2):"right"==this.position&&(i.x=t.left+t.width-this.labelHeight,i.y=t.height/2+t.top-this.labelWidth/2),i},b.prototype.draw=function(t){f.prototype.draw.call(this,t),this.requiresResize&&(this.elem=this.plot.getPlaceholder().find("."+this.axisName+"Label"),this.elem.css("width",this.labelWidth),this.elem.css("height",this.labelHeight))},s.plot.plugins.push({init:function(t){t.hooks.processOptions.push(function(t,i){if(i.axisLabels.show){var e=!1,n={};t.hooks.draw.push(function(l,t){var h=!1;e?(e=!1,s.each(l.getAxes(),function(t,i){var e=i.options||l.getOptions()[t];e&&e.axisLabel&&i.show&&n[t].draw(i.box)})):(s.each(l.getAxes(),function(t,i){var e=i.options||l.getOptions()[t];if(t in n&&(i.labelHeight=i.labelHeight-n[t].height,i.labelWidth=i.labelWidth-n[t].width,e.labelHeight=i.labelHeight,e.labelWidth=i.labelWidth,n[t].cleanup(),delete n[t]),e&&e.axisLabel&&i.show){h=!0;var s=null;if(e.axisLabelUseHtml||"Microsoft Internet Explorer"!=navigator.appName)s=e.axisLabelUseHtml||!p()&&!r()&&!e.axisLabelUseCanvas?c:e.axisLabelUseCanvas||!p()?d:f;else{var o=navigator.userAgent;null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(o)&&(rv=parseFloat(RegExp.$1)),s=9<=rv&&!e.axisLabelUseCanvas&&!e.axisLabelUseHtml?f:e.axisLabelUseCanvas||e.axisLabelUseHtml?e.axisLabelUseCanvas?d:c:b}var a=void 0===e.axisLabelPadding?2:e.axisLabelPadding;n[t]=new s(t,i.position,a,l,e),n[t].calculateSize(),e.labelHeight=i.labelHeight+n[t].height,e.labelWidth=i.labelWidth+n[t].width}}),h&&(e=!0,l.setupGrid(),l.draw()))})}})},options:{axisLabels:{show:!0}},name:"axisLabels",version:"2.0"})}(jQuery);
//# sourceMappingURL=../../sourcemaps/pages/jquery.flot.axislabels.min.js.map