All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template.js.flot.jquery.canvaswrapper.min.js Maven / Gradle / Ivy

'use strict';(function(q){function r(b,a){b.transform.baseVal.clear();a&&a.forEach(function(a){b.transform.baseVal.appendItem(a)})}var n=function(b,a){var c=a.getElementsByClassName(b)[0];if(!c&&(c=document.createElement("canvas"),c.className=b,c.style.direction="ltr",c.style.position="absolute",c.style.left="0px",c.style.top="0px",a.appendChild(c),!c.getContext))throw Error("Canvas is not available.");this.element=c;b=this.context=c.getContext("2d");this.pixelRatio=q.plot.browser.getPixelRatio(b);
b=q(a).width();a=q(a).height();this.resize(b,a);this.SVGContainer=null;this.SVG={};this._textCache={}};n.prototype.resize=function(b,a){b=10>b?10:b;a=10>a?10:a;var c=this.element,e=this.context,g=this.pixelRatio;this.width!==b&&(c.width=b*g,c.style.width=b+"px",this.width=b);this.height!==a&&(c.height=a*g,c.style.height=a+"px",this.height=a);e.restore();e.save();e.scale(g,g)};n.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)};n.prototype.render=function(){var b=this._textCache,
a;for(a in b)if(hasOwnProperty.call(b,a)){var c=this.getSVGLayer(a),e=b[a],g=c.style.display;c.style.display="none";for(var d in e)if(hasOwnProperty.call(e,d)){var h=e[d],k;for(k in h)if(hasOwnProperty.call(h,k)){for(var f=h[k],l=f.positions,p=0,m;l[p];p++)if(m=l[p],m.active)m.rendered||(c.appendChild(m.element),m.rendered=!0);else if(l.splice(p--,1),m.rendered){for(;m.element.firstChild;)m.element.removeChild(m.element.firstChild);m.element.parentNode.removeChild(m.element)}0===l.length&&(f.measured?
f.measured=!1:delete h[k])}}c.style.display=g}};n.prototype.getSVGLayer=function(b){var a=this.SVG[b];if(!a){var c;this.SVGContainer?c=this.SVGContainer.firstChild:(this.SVGContainer=document.createElement("div"),this.SVGContainer.className="flot-svg",this.SVGContainer.style.position="absolute",this.SVGContainer.style.top="0px",this.SVGContainer.style.left="0px",this.SVGContainer.style.height="100%",this.SVGContainer.style.width="100%",this.SVGContainer.style.pointerEvents="none",this.element.parentNode.appendChild(this.SVGContainer),
c=document.createElementNS("http://www.w3.org/2000/svg","svg"),c.style.width="100%",c.style.height="100%",this.SVGContainer.appendChild(c));a=document.createElementNS("http://www.w3.org/2000/svg","g");a.setAttribute("class",b);a.style.position="absolute";a.style.top="0px";a.style.left="0px";a.style.bottom="0px";a.style.right="0px";c.appendChild(a);this.SVG[b]=a}return a};n.prototype.getTextInfo=function(b,a,c,e,g){var d,h,k;a=""+a;d="object"===typeof c?c.style+" "+c.variant+" "+c.weight+" "+c.size+
"px/"+c.lineHeight+"px "+c.family:c;h=this._textCache[b];null==h&&(h=this._textCache[b]={});e=h[d];null==e&&(e=h[d]={});h=a.replace(/0|1|2|3|4|5|6|7|8|9/g,"0");k=e[h];if(!k){var f=document.createElementNS("http://www.w3.org/2000/svg","text");-1!==a.indexOf("\x3cbr\x3e")?t(a,f,-9999):(a=document.createTextNode(a),f.appendChild(a));f.style.position="absolute";f.style.maxWidth=g;f.setAttributeNS(null,"x",-9999);f.setAttributeNS(null,"y",-9999);"object"===typeof c?(f.style.font=d,f.style.fill=c.fill):
"string"===typeof c&&f.setAttribute("class",c);this.getSVGLayer(b).appendChild(f);b=f.getBBox();for(k=e[h]={width:b.width,height:b.height,measured:!0,element:f,positions:[]};f.firstChild;)f.removeChild(f.firstChild);f.parentNode.removeChild(f)}k.measured=!0;return k};n.prototype.addText=function(b,a,c,e,g,d,h,k,f,l){b=this.getTextInfo(b,e,g,d,h);g=b.positions;"center"===k?a-=b.width/2:"right"===k&&(a-=b.width);"middle"===f?c-=b.height/2:"bottom"===f&&(c-=b.height);c+=.75*b.height;for(f=0;g[f];f++){d=
g[f];if(d.x===a&&d.y===c&&d.text===e){d.active=!0;r(d.element,l);return}if(!1===d.active){d.active=!0;d.text=e;-1!==e.indexOf("\x3cbr\x3e")?(c-=.25*b.height,t(e,d.element,a)):d.element.textContent=e;d.element.setAttributeNS(null,"x",a);d.element.setAttributeNS(null,"y",c);d.x=a;d.y=c;r(d.element,l);return}}d={active:!0,rendered:!1,element:g.length?b.element.cloneNode():b.element,text:e,x:a,y:c};g.push(d);-1!==e.indexOf("\x3cbr\x3e")?(c-=.25*b.height,t(e,d.element,a)):d.element.textContent=e;d.element.setAttributeNS(null,
"x",a);d.element.setAttributeNS(null,"y",c);d.element.style.textAlign=k;r(d.element,l)};var t=function(b,a,c){b=b.split("\x3cbr\x3e");var e,g,d;for(g=0;g




© 2015 - 2025 Weber Informatics LLC | Privacy Policy