woocommerce/assets/js/jquery-flot/jquery.flot.min.js

1 line
35 KiB
JavaScript

!function(t){t.color={},t.color.make=function(i,e,o,n){var r={};return r.r=i||0,r.g=e||0,r.b=o||0,r.a=null!=n?n:1,r.add=function(t,i){for(var e=0;e<t.length;++e)r[t.charAt(e)]+=i;return r.normalize()},r.scale=function(t,i){for(var e=0;e<t.length;++e)r[t.charAt(e)]*=i;return r.normalize()},r.toString=function(){return r.a>=1?"rgb("+[r.r,r.g,r.b].join(",")+")":"rgba("+[r.r,r.g,r.b,r.a].join(",")+")"},r.normalize=function(){function t(t,i,e){return i<t?t:i>e?e:i}return r.r=t(0,parseInt(r.r),255),r.g=t(0,parseInt(r.g),255),r.b=t(0,parseInt(r.b),255),r.a=t(0,r.a,1),r},r.clone=function(){return t.color.make(r.r,r.b,r.g,r.a)},r.normalize()},t.color.extract=function(i,e){var o;do{if(""!=(o=i.css(e).toLowerCase())&&"transparent"!=o)break;i=i.parent()}while(!t.nodeName(i.get(0),"body"));return"rgba(0, 0, 0, 0)"==o&&(o="transparent"),t.color.parse(o)},t.color.parse=function(e){var o,n=t.color.make;if(o=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e))return n(parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10));if(o=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return n(parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10),parseFloat(o[4]));if(o=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e))return n(2.55*parseFloat(o[1]),2.55*parseFloat(o[2]),2.55*parseFloat(o[3]));if(o=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return n(2.55*parseFloat(o[1]),2.55*parseFloat(o[2]),2.55*parseFloat(o[3]),parseFloat(o[4]));if(o=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e))return n(parseInt(o[1],16),parseInt(o[2],16),parseInt(o[3],16));if(o=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e))return n(parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16),parseInt(o[3]+o[3],16));var r=t.trim(e).toLowerCase();return"transparent"==r?n(255,255,255,0):(o=i[r]||[0,0,0],n(o[0],o[1],o[2]))};var i={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}}(jQuery),function(t){function i(i,e){var o=e.children("."+i)[0];if(null==o&&(o=document.createElement("canvas"),o.className=i,t(o).css({direction:"ltr",position:"absolute",left:0,top:0}).appendTo(e),!o.getContext)){if(!window.G_vmlCanvasManager)throw new Error("Canvas is not available. If you're using IE with a fall-back such as Excanvas, then there's either a mistake in your conditional include, or the page has no DOCTYPE and is rendering in Quirks Mode.");o=window.G_vmlCanvasManager.initElement(o)}this.element=o;var n=this.context=o.getContext("2d"),r=window.devicePixelRatio||1,a=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1;this.pixelRatio=r/a,this.resize(e.width(),e.height()),this.textContainer=null,this.text={},this._textCache={}}function e(e,n,r,a){function l(t,i){i=[ft].concat(i);for(var e=0;e<t.length;++e)t[e].apply(this,i)}function s(t){$=c(t),p(),m()}function c(i){for(var e=[],o=0;o<i.length;++o){var n=t.extend(!0,{},K.series);null!=i[o].data?(n.data=i[o].data,delete i[o].data,t.extend(!0,n,i[o]),i[o].data=n.data):n.data=i[o],e.push(n)}return e}function f(t,i){var e=t[i+"axis"];return"object"==typeof e&&(e=e.n),"number"!=typeof e&&(e=1),e}function h(){return t.grep(nt.concat(rt),function(t){return t})}function u(t){var i,e,o={};for(i=0;i<nt.length;++i)(e=nt[i])&&e.used&&(o["x"+e.n]=e.c2p(t.left));for(i=0;i<rt.length;++i)(e=rt[i])&&e.used&&(o["y"+e.n]=e.c2p(t.top));return o.x1!==undefined&&(o.x=o.x1),o.y1!==undefined&&(o.y=o.y1),o}function d(i,e){return i[e-1]||(i[e-1]={n:e,direction:i==nt?"x":"y",options:t.extend(!0,{},i==nt?K.xaxis:K.yaxis)}),i[e-1]}function p(){var i,e=$.length,o=-1;for(i=0;i<$.length;++i){var n=$[i].color;null!=n&&(e--,"number"==typeof n&&n>o&&(o=n))}e<=o&&(e=o+1);var r,a=[],l=K.colors,s=l.length,c=0;for(i=0;i<e;i++)r=t.color.parse(l[i%s]||"#666"),i%s==0&&i&&(c=c>=0?c<.5?-c-.2:0:-c),a[i]=r.scale("rgb",1+c);var h,u=0;for(i=0;i<$.length;++i){if(null==(h=$[i]).color?(h.color=a[u].toString(),++u):"number"==typeof h.color&&(h.color=a[h.color].toString()),null==h.lines.show){var p,m=!0;for(p in h)if(h[p]&&h[p].show){m=!1;break}m&&(h.lines.show=!0)}null==h.lines.zero&&(h.lines.zero=!!h.lines.fill),h.xaxis=d(nt,f(h,"x")),h.yaxis=d(rt,f(h,"y"))}}function m(){function i(t,i,e){i<t.datamin&&i!=-b&&(t.datamin=i),e>t.datamax&&e!=b&&(t.datamax=e)}var e,o,n,r,a,s,c,f,u,d,p,m,x=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,b=Number.MAX_VALUE;for(t.each(h(),function(t,i){i.datamin=x,i.datamax=g,i.used=!1}),e=0;e<$.length;++e)(a=$[e]).datapoints={points:[]},l(ct.processRawData,[a,a.data,a.datapoints]);for(e=0;e<$.length;++e){if(a=$[e],p=a.data,!(m=a.datapoints.format)){if((m=[]).push({x:!0,number:!0,required:!0}),m.push({y:!0,number:!0,required:!0}),a.bars.show||a.lines.show&&a.lines.fill){var v=!!(a.bars.show&&a.bars.zero||a.lines.show&&a.lines.zero);m.push({y:!0,number:!0,required:!1,defaultValue:0,autoscale:v}),a.bars.horizontal&&(delete m[m.length-1].y,m[m.length-1].x=!0)}a.datapoints.format=m}if(null==a.datapoints.pointsize){a.datapoints.pointsize=m.length,c=a.datapoints.pointsize,s=a.datapoints.points;var k=a.lines.show&&a.lines.steps;for(a.xaxis.used=a.yaxis.used=!0,o=n=0;o<p.length;++o,n+=c){var y=null==(d=p[o]);if(!y)for(r=0;r<c;++r)f=d[r],(u=m[r])&&(u.number&&null!=f&&(f=+f,isNaN(f)?f=null:f==Infinity?f=b:f==-Infinity&&(f=-b)),null==f&&(u.required&&(y=!0),null!=u.defaultValue&&(f=u.defaultValue))),s[n+r]=f;if(y)for(r=0;r<c;++r)null!=(f=s[n+r])&&(u=m[r]).autoscale&&(u.x&&i(a.xaxis,f,f),u.y&&i(a.yaxis,f,f)),s[n+r]=null;else if(k&&n>0&&null!=s[n-c]&&s[n-c]!=s[n]&&s[n-c+1]!=s[n+1]){for(r=0;r<c;++r)s[n+c+r]=s[n+r];s[n+1]=s[n-c+1],n+=c}}}}for(e=0;e<$.length;++e)a=$[e],l(ct.processDatapoints,[a,a.datapoints]);for(e=0;e<$.length;++e){s=(a=$[e]).datapoints.points,c=a.datapoints.pointsize,m=a.datapoints.format;var w=x,T=x,M=g,C=g;for(o=0;o<s.length;o+=c)if(null!=s[o])for(r=0;r<c;++r)f=s[o+r],(u=m[r])&&!1!==u.autoscale&&f!=b&&f!=-b&&(u.x&&(f<w&&(w=f),f>M&&(M=f)),u.y&&(f<T&&(T=f),f>C&&(C=f)));if(a.bars.show){var S;switch(a.bars.align){case"left":S=0;break;case"right":S=-a.bars.barWidth;break;case"center":S=-a.bars.barWidth/2;break;default:throw new Error("Invalid bar alignment: "+a.bars.align)}a.bars.horizontal?(T+=S,C+=S+a.bars.barWidth):(w+=S,M+=S+a.bars.barWidth)}i(a.xaxis,w,M),i(a.yaxis,T,C)}t.each(h(),function(t,i){i.datamin==x&&(i.datamin=null),i.datamax==g&&(i.datamax=null)})}function x(t){function i(t){return t}var e,o,n=t.options.transform||i,r=t.options.inverseTransform;"x"==t.direction?(e=t.scale=lt/Math.abs(n(t.max)-n(t.min)),o=Math.min(n(t.max),n(t.min))):(e=t.scale=st/Math.abs(n(t.max)-n(t.min)),e=-e,o=Math.max(n(t.max),n(t.min))),t.p2c=n==i?function(t){return(t-o)*e}:function(t){return(n(t)-o)*e},t.c2p=r?function(t){return r(o+t/e)}:function(t){return o+t/e}}function g(t){var i=t.options,e=t.ticks||[],o=i.labelWidth||0,n=i.labelHeight||0,r=o||"x"==t.direction?Math.floor(Z.width/(e.length||1)):null;legacyStyles=t.direction+"Axis "+t.direction+t.n+"Axis",layer="flot-"+t.direction+"-axis flot-"+t.direction+t.n+"-axis "+legacyStyles,font=i.font||"flot-tick-label tickLabel";for(var a=0;a<e.length;++a){var l=e[a];if(l.label){var s=Z.getTextInfo(layer,l.label,font,null,r);o=Math.max(o,s.width),n=Math.max(n,s.height)}}t.labelWidth=i.labelWidth||o,t.labelHeight=i.labelHeight||n}function b(i){var e,o=i.labelWidth,n=i.labelHeight,r=i.options.position,a=i.options.tickLength,l=K.grid.axisMargin,s=K.grid.labelMargin,c="x"==i.direction?nt:rt,f=t.grep(c,function(t){return t&&t.options.position==r&&t.reserveSpace});if(t.inArray(i,f)==f.length-1&&(l=0),null==a){var h=t.grep(c,function(t){return t&&t.reserveSpace});a=(e=0==t.inArray(i,h))?"full":5}isNaN(+a)||(s+=+a),"x"==i.direction?(n+=s,"bottom"==r?(at.bottom+=n+l,i.box={top:Z.height-at.bottom,height:n}):(i.box={top:at.top+l,height:n},at.top+=n+l)):(o+=s,"left"==r?(i.box={left:at.left+l,width:o},at.left+=o+l):(at.right+=o+l,i.box={left:Z.width-at.right,width:o})),i.position=r,i.tickLength=a,i.box.padding=s,i.innermost=e}function v(t){"x"==t.direction?(t.box.left=at.left-t.labelWidth/2,t.box.width=Z.width-at.left-at.right+t.labelWidth):(t.box.top=at.top-t.labelHeight/2,t.box.height=Z.height-at.bottom-at.top+t.labelHeight)}function k(){var i,e=K.grid.minBorderMargin,o={x:0,y:0};if(null==e)for(e=0,i=0;i<$.length;++i)e=Math.max(e,2*($[i].points.radius+$[i].points.lineWidth/2));o.x=o.y=Math.ceil(e),t.each(h(),function(t,i){var e=i.direction;i.reserveSpace&&(o[e]=Math.ceil(Math.max(o[e],("x"==e?i.labelWidth:i.labelHeight)/2)))}),at.left=Math.max(o.x,at.left),at.right=Math.max(o.x,at.right),at.top=Math.max(o.y,at.top),at.bottom=Math.max(o.y,at.bottom)}function y(){var i,e=h(),o=K.grid.show;for(var n in at){var r=K.grid.margin||0;at[n]="number"==typeof r?r:r[n]||0}l(ct.processOffset,[at]);for(var n in at)"object"==typeof K.grid.borderWidth?at[n]+=o?K.grid.borderWidth[n]:0:at[n]+=o?K.grid.borderWidth:0;if(t.each(e,function(t,i){i.show=i.options.show,null==i.show&&(i.show=i.used),i.reserveSpace=i.show||i.options.reserveSpace,w(i)}),o){var a=t.grep(e,function(t){return t.reserveSpace});for(t.each(a,function(t,i){T(i),M(i),C(i,i.ticks),g(i)}),i=a.length-1;i>=0;--i)b(a[i]);k(),t.each(a,function(t,i){v(i)})}lt=Z.width-at.left-at.right,st=Z.height-at.bottom-at.top,t.each(e,function(t,i){x(i)}),o&&A(),E()}function w(t){var i=t.options,e=+(null!=i.min?i.min:t.datamin),o=+(null!=i.max?i.max:t.datamax),n=o-e;if(0==n){var r=0==o?1:.01;null==i.min&&(e-=r),null!=i.max&&null==i.min||(o+=r)}else{var a=i.autoscaleMargin;null!=a&&(null==i.min&&(e-=n*a)<0&&null!=t.datamin&&t.datamin>=0&&(e=0),null==i.max&&(o+=n*a)>0&&null!=t.datamax&&t.datamax<=0&&(o=0))}t.min=e,t.max=o}function T(i){var e,n=i.options;e="number"==typeof n.ticks&&n.ticks>0?n.ticks:.3*Math.sqrt("x"==i.direction?Z.width:Z.height);var r=(i.max-i.min)/e,a=-Math.floor(Math.log(r)/Math.LN10),l=n.tickDecimals;null!=l&&a>l&&(a=l);var s,c=Math.pow(10,-a),f=r/c;if(f<1.5?s=1:f<3?(s=2,f>2.25&&(null==l||a+1<=l)&&(s=2.5,++a)):s=f<7.5?5:10,s*=c,null!=n.minTickSize&&s<n.minTickSize&&(s=n.minTickSize),i.delta=r,i.tickDecimals=Math.max(0,null!=l?l:a),i.tickSize=n.tickSize||s,"time"==n.mode&&!i.tickGenerator)throw new Error("Time mode requires the flot.time plugin.");if(i.tickGenerator||(i.tickGenerator=function(t){var i,e=[],n=o(t.min,t.tickSize),r=0,a=Number.NaN;do{i=a,a=n+r*t.tickSize,e.push(a),++r}while(a<t.max&&a!=i);return e},i.tickFormatter=function(t,i){var e=i.tickDecimals?Math.pow(10,i.tickDecimals):1,o=""+Math.round(t*e)/e;if(null!=i.tickDecimals){var n=o.indexOf("."),r=-1==n?0:o.length-n-1;if(r<i.tickDecimals)return(r?o:o+".")+(""+e).substr(1,i.tickDecimals-r)}return o}),t.isFunction(n.tickFormatter)&&(i.tickFormatter=function(t,i){return""+n.tickFormatter(t,i)}),null!=n.alignTicksWithAxis){var h=("x"==i.direction?nt:rt)[n.alignTicksWithAxis-1];if(h&&h.used&&h!=i){var u=i.tickGenerator(i);if(u.length>0&&(null==n.min&&(i.min=Math.min(i.min,u[0])),null==n.max&&u.length>1&&(i.max=Math.max(i.max,u[u.length-1]))),i.tickGenerator=function(t){var i,e,o=[];for(e=0;e<h.ticks.length;++e)i=(h.ticks[e].v-h.min)/(h.max-h.min),i=t.min+i*(t.max-t.min),o.push(i);return o},!i.mode&&null==n.tickDecimals){var d=Math.max(0,1-Math.floor(Math.log(i.delta)/Math.LN10)),p=i.tickGenerator(i);p.length>1&&/\..*0$/.test((p[1]-p[0]).toFixed(d))||(i.tickDecimals=d)}}}}function M(i){var e=i.options.ticks,o=[];null==e||"number"==typeof e&&e>0?o=i.tickGenerator(i):e&&(o=t.isFunction(e)?e(i):e);var n,r;for(i.ticks=[],n=0;n<o.length;++n){var a=null,l=o[n];"object"==typeof l?(r=+l[0],l.length>1&&(a=l[1])):r=+l,null==a&&(a=i.tickFormatter(r,i)),isNaN(r)||i.ticks.push({v:r,label:a})}}function C(t,i){t.options.autoscaleMargin&&i.length>0&&(null==t.options.min&&(t.min=Math.min(t.min,i[0].v)),null==t.options.max&&i.length>1&&(t.max=Math.max(t.max,i[i.length-1].v)))}function S(){Z.clear(),l(ct.drawBackground,[et]);var t=K.grid;t.show&&t.backgroundColor&&z(),t.show&&!t.aboveData&&I();for(var i=0;i<$.length;++i)l(ct.drawSeries,[et,$[i]]),P($[i]);l(ct.draw,[et]),t.show&&t.aboveData&&I(),Z.render(),_()}function W(t,i){for(var e,o,n,r,a=h(),l=0;l<a.length;++l)if((e=a[l]).direction==i&&(r=i+e.n+"axis",t[r]||1!=e.n||(r=i+"axis"),t[r])){o=t[r].from,n=t[r].to;break}if(t[r]||(e="x"==i?nt[0]:rt[0],o=t[i+"1"],n=t[i+"2"]),null!=o&&null!=n&&o>n){var s=o;o=n,n=s}return{from:o,to:n,axis:e}}function z(){et.save(),et.translate(at.left,at.top),et.fillStyle=J(K.grid.backgroundColor,st,0,"rgba(255, 255, 255, 0)"),et.fillRect(0,0,lt,st),et.restore()}function I(){var i,e,o,n;et.save(),et.translate(at.left,at.top);var r=K.grid.markings;if(r)for(t.isFunction(r)&&((e=ft.getAxes()).xmin=e.xaxis.min,e.xmax=e.xaxis.max,e.ymin=e.yaxis.min,e.ymax=e.yaxis.max,r=r(e)),i=0;i<r.length;++i){var a=r[i],l=W(a,"x"),s=W(a,"y");null==l.from&&(l.from=l.axis.min),null==l.to&&(l.to=l.axis.max),null==s.from&&(s.from=s.axis.min),null==s.to&&(s.to=s.axis.max),l.to<l.axis.min||l.from>l.axis.max||s.to<s.axis.min||s.from>s.axis.max||(l.from=Math.max(l.from,l.axis.min),l.to=Math.min(l.to,l.axis.max),s.from=Math.max(s.from,s.axis.min),s.to=Math.min(s.to,s.axis.max),l.from==l.to&&s.from==s.to||(l.from=l.axis.p2c(l.from),l.to=l.axis.p2c(l.to),s.from=s.axis.p2c(s.from),s.to=s.axis.p2c(s.to),l.from==l.to||s.from==s.to?(et.beginPath(),et.strokeStyle=a.color||K.grid.markingsColor,et.lineWidth=a.lineWidth||K.grid.markingsLineWidth,et.moveTo(l.from,s.from),et.lineTo(l.to,s.to),et.stroke()):(et.fillStyle=a.color||K.grid.markingsColor,et.fillRect(l.from,s.to,l.to-l.from,s.from-s.to))))}e=h(),o=K.grid.borderWidth;for(var c=0;c<e.length;++c){var f,u,d,p,m=e[c],x=m.box,g=m.tickLength;if(m.show&&0!=m.ticks.length){for(et.lineWidth=1,"x"==m.direction?(f=0,u="full"==g?"top"==m.position?0:st:x.top-at.top+("top"==m.position?x.height:0)):(u=0,f="full"==g?"left"==m.position?0:lt:x.left-at.left+("left"==m.position?x.width:0)),m.innermost||(et.strokeStyle=m.options.color,et.beginPath(),d=p=0,"x"==m.direction?d=lt+1:p=st+1,1==et.lineWidth&&("x"==m.direction?u=Math.floor(u)+.5:f=Math.floor(f)+.5),et.moveTo(f,u),et.lineTo(f+d,u+p),et.stroke()),et.strokeStyle=m.options.tickColor,et.beginPath(),i=0;i<m.ticks.length;++i){var b=m.ticks[i].v;d=p=0,isNaN(b)||b<m.min||b>m.max||"full"==g&&("object"==typeof o&&o[m.position]>0||o>0)&&(b==m.min||b==m.max)||("x"==m.direction?(f=m.p2c(b),p="full"==g?-st:g,"top"==m.position&&(p=-p)):(u=m.p2c(b),d="full"==g?-lt:g,"left"==m.position&&(d=-d)),1==et.lineWidth&&("x"==m.direction?f=Math.floor(f)+.5:u=Math.floor(u)+.5),et.moveTo(f,u),et.lineTo(f+d,u+p))}et.stroke()}}o&&(n=K.grid.borderColor,"object"==typeof o||"object"==typeof n?("object"!=typeof o&&(o={top:o,right:o,bottom:o,left:o}),"object"!=typeof n&&(n={top:n,right:n,bottom:n,left:n}),o.top>0&&(et.strokeStyle=n.top,et.lineWidth=o.top,et.beginPath(),et.moveTo(0-o.left,0-o.top/2),et.lineTo(lt,0-o.top/2),et.stroke()),o.right>0&&(et.strokeStyle=n.right,et.lineWidth=o.right,et.beginPath(),et.moveTo(lt+o.right/2,0-o.top),et.lineTo(lt+o.right/2,st),et.stroke()),o.bottom>0&&(et.strokeStyle=n.bottom,et.lineWidth=o.bottom,et.beginPath(),et.moveTo(lt+o.right,st+o.bottom/2),et.lineTo(0,st+o.bottom/2),et.stroke()),o.left>0&&(et.strokeStyle=n.left,et.lineWidth=o.left,et.beginPath(),et.moveTo(0-o.left/2,st+o.bottom),et.lineTo(0-o.left/2,0),et.stroke())):(et.lineWidth=o,et.strokeStyle=K.grid.borderColor,et.strokeRect(-o/2,-o/2,lt+o,st+o))),et.restore()}function A(){t.each(h(),function(t,i){if(i.show&&0!=i.ticks.length){var e,o,n,r,a,l=i.box,s=i.direction+"Axis "+i.direction+i.n+"Axis",c="flot-"+i.direction+"-axis flot-"+i.direction+i.n+"-axis "+s,f=i.options.font||"flot-tick-label tickLabel";Z.removeText(c);for(var h=0;h<i.ticks.length;++h)!(e=i.ticks[h]).label||e.v<i.min||e.v>i.max||("x"==i.direction?(r="center",o=at.left+i.p2c(e.v),"bottom"==i.position?n=l.top+l.padding:(n=l.top+l.height-l.padding,a="bottom")):(a="middle",n=at.top+i.p2c(e.v),"left"==i.position?(o=l.left+l.width-l.padding,r="right"):o=l.left+l.padding),Z.addText(c,o,n,e.label,f,null,null,r,a))}})}function P(t){t.lines.show&&F(t),t.bars.show&&L(t),t.points.show&&N(t)}function F(t){function i(t,i,e,o,n){var r=t.points,a=t.pointsize,l=null,s=null;et.beginPath();for(var c=a;c<r.length;c+=a){var f=r[c-a],h=r[c-a+1],u=r[c],d=r[c+1];if(null!=f&&null!=u){if(h<=d&&h<n.min){if(d<n.min)continue;f=(n.min-h)/(d-h)*(u-f)+f,h=n.min}else if(d<=h&&d<n.min){if(h<n.min)continue;u=(n.min-h)/(d-h)*(u-f)+f,d=n.min}if(h>=d&&h>n.max){if(d>n.max)continue;f=(n.max-h)/(d-h)*(u-f)+f,h=n.max}else if(d>=h&&d>n.max){if(h>n.max)continue;u=(n.max-h)/(d-h)*(u-f)+f,d=n.max}if(f<=u&&f<o.min){if(u<o.min)continue;h=(o.min-f)/(u-f)*(d-h)+h,f=o.min}else if(u<=f&&u<o.min){if(f<o.min)continue;d=(o.min-f)/(u-f)*(d-h)+h,u=o.min}if(f>=u&&f>o.max){if(u>o.max)continue;h=(o.max-f)/(u-f)*(d-h)+h,f=o.max}else if(u>=f&&u>o.max){if(f>o.max)continue;d=(o.max-f)/(u-f)*(d-h)+h,u=o.max}f==l&&h==s||et.moveTo(o.p2c(f)+i,n.p2c(h)+e),l=u,s=d,et.lineTo(o.p2c(u)+i,n.p2c(d)+e)}}et.stroke()}et.save(),et.translate(at.left,at.top),et.lineJoin="round";var e=t.lines.lineWidth,o=t.shadowSize;if(e>0&&o>0){et.lineWidth=o,et.strokeStyle="rgba(0,0,0,0.1)";var n=Math.PI/18;i(t.datapoints,Math.sin(n)*(e/2+o/2),Math.cos(n)*(e/2+o/2),t.xaxis,t.yaxis),et.lineWidth=o/2,i(t.datapoints,Math.sin(n)*(e/2+o/4),Math.cos(n)*(e/2+o/4),t.xaxis,t.yaxis)}et.lineWidth=e,et.strokeStyle=t.color;var r=O(t.lines,t.color,0,st);r&&(et.fillStyle=r,function(t,i,e){for(var o=t.points,n=t.pointsize,r=Math.min(Math.max(0,e.min),e.max),a=0,l=!1,s=1,c=0,f=0;!(n>0&&a>o.length+n);){var h=o[(a+=n)-n],u=o[a-n+s],d=o[a],p=o[a+s];if(l){if(n>0&&null!=h&&null==d){f=a,n=-n,s=2;continue}if(n<0&&a==c+n){et.fill(),l=!1,s=1,a=c=f+(n=-n);continue}}if(null!=h&&null!=d){if(h<=d&&h<i.min){if(d<i.min)continue;u=(i.min-h)/(d-h)*(p-u)+u,h=i.min}else if(d<=h&&d<i.min){if(h<i.min)continue;p=(i.min-h)/(d-h)*(p-u)+u,d=i.min}if(h>=d&&h>i.max){if(d>i.max)continue;u=(i.max-h)/(d-h)*(p-u)+u,h=i.max}else if(d>=h&&d>i.max){if(h>i.max)continue;p=(i.max-h)/(d-h)*(p-u)+u,d=i.max}if(l||(et.beginPath(),et.moveTo(i.p2c(h),e.p2c(r)),l=!0),u>=e.max&&p>=e.max)et.lineTo(i.p2c(h),e.p2c(e.max)),et.lineTo(i.p2c(d),e.p2c(e.max));else if(u<=e.min&&p<=e.min)et.lineTo(i.p2c(h),e.p2c(e.min)),et.lineTo(i.p2c(d),e.p2c(e.min));else{var m=h,x=d;u<=p&&u<e.min&&p>=e.min?(h=(e.min-u)/(p-u)*(d-h)+h,u=e.min):p<=u&&p<e.min&&u>=e.min&&(d=(e.min-u)/(p-u)*(d-h)+h,p=e.min),u>=p&&u>e.max&&p<=e.max?(h=(e.max-u)/(p-u)*(d-h)+h,u=e.max):p>=u&&p>e.max&&u<=e.max&&(d=(e.max-u)/(p-u)*(d-h)+h,p=e.max),h!=m&&et.lineTo(i.p2c(m),e.p2c(u)),et.lineTo(i.p2c(h),e.p2c(u)),et.lineTo(i.p2c(d),e.p2c(p)),d!=x&&(et.lineTo(i.p2c(d),e.p2c(p)),et.lineTo(i.p2c(x),e.p2c(p)))}}}}(t.datapoints,t.xaxis,t.yaxis)),e>0&&i(t.datapoints,0,0,t.xaxis,t.yaxis),et.restore()}function N(t){function i(t,i,e,o,n,r,a,l){for(var s=t.points,c=t.pointsize,f=0;f<s.length;f+=c){var h=s[f],u=s[f+1];null==h||h<r.min||h>r.max||u<a.min||u>a.max||(et.beginPath(),h=r.p2c(h),u=a.p2c(u)+o,"circle"==l?et.arc(h,u,i,0,n?Math.PI:2*Math.PI,!1):l(et,h,u,i,n),et.closePath(),e&&(et.fillStyle=e,et.fill()),et.stroke())}}et.save(),et.translate(at.left,at.top);var e=t.points.lineWidth,o=t.shadowSize,n=t.points.radius,r=t.points.symbol;if(0==e&&(e=1e-4),e>0&&o>0){var a=o/2;et.lineWidth=a,et.strokeStyle="rgba(0,0,0,0.1)",i(t.datapoints,n,null,a+a/2,!0,t.xaxis,t.yaxis,r),et.strokeStyle="rgba(0,0,0,0.2)",i(t.datapoints,n,null,a/2,!0,t.xaxis,t.yaxis,r)}et.lineWidth=e,et.strokeStyle=t.color,i(t.datapoints,n,O(t.points,t.color),0,!1,t.xaxis,t.yaxis,r),et.restore()}function D(t,i,e,o,n,r,a,l,s,c,f,h){var u,d,p,m,x,g,b,v,k;f?(v=g=b=!0,x=!1,m=i+o,p=i+n,(d=t)<(u=e)&&(k=d,d=u,u=k,x=!0,g=!1)):(x=g=b=!0,v=!1,u=t+o,d=t+n,(m=i)<(p=e)&&(k=m,m=p,p=k,v=!0,b=!1)),d<l.min||u>l.max||m<s.min||p>s.max||(u<l.min&&(u=l.min,x=!1),d>l.max&&(d=l.max,g=!1),p<s.min&&(p=s.min,v=!1),m>s.max&&(m=s.max,b=!1),u=l.p2c(u),p=s.p2c(p),d=l.p2c(d),m=s.p2c(m),a&&(c.beginPath(),c.moveTo(u,p),c.lineTo(u,m),c.lineTo(d,m),c.lineTo(d,p),c.fillStyle=a(p,m),c.fill()),h>0&&(x||g||b||v)&&(c.beginPath(),c.moveTo(u,p+r),x?c.lineTo(u,m+r):c.moveTo(u,m+r),b?c.lineTo(d,m+r):c.moveTo(d,m+r),g?c.lineTo(d,p+r):c.moveTo(d,p+r),v?c.lineTo(u,p+r):c.moveTo(u,p+r),c.stroke()))}function L(t){et.save(),et.translate(at.left,at.top),et.lineWidth=t.bars.lineWidth,et.strokeStyle=t.color;var i;switch(t.bars.align){case"left":i=0;break;case"right":i=-t.bars.barWidth;break;case"center":i=-t.bars.barWidth/2;break;default:throw new Error("Invalid bar alignment: "+t.bars.align)}var e=t.bars.fill?function(i,e){return O(t.bars,t.color,i,e)}:null;!function(i,e,o,n,r,a,l){for(var s=i.points,c=i.pointsize,f=0;f<s.length;f+=c)null!=s[f]&&D(s[f],s[f+1],s[f+2],e,o,n,r,a,l,et,t.bars.horizontal,t.bars.lineWidth)}(t.datapoints,i,i+t.bars.barWidth,0,e,t.xaxis,t.yaxis),et.restore()}function O(i,e,o,n){var r=i.fill;if(!r)return null;if(i.fillColor)return J(i.fillColor,o,n,e);var a=t.color.parse(e);return a.a="number"==typeof r?r:.4,a.normalize(),a.toString()}function E(){if(e.find(".legend").remove(),K.legend.show){for(var i,o,n=[],r=[],a=!1,l=K.legend.labelFormatter,s=0;s<$.length;++s)(i=$[s]).label&&(o=l?l(i.label,i):i.label)&&r.push({label:o,color:i.color});if(K.legend.sorted)if(t.isFunction(K.legend.sorted))r.sort(K.legend.sorted);else if("reverse"==K.legend.sorted)r.reverse();else{var c="descending"!=K.legend.sorted;r.sort(function(t,i){return t.label==i.label?0:t.label<i.label!=c?1:-1})}for(s=0;s<r.length;++s){var f=r[s];s%K.legend.noColumns==0&&(a&&n.push("</tr>"),n.push("<tr>"),a=!0),n.push('<td class="legendColorBox"><div style="border:1px solid '+K.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+f.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+f.label+"</td>")}if(a&&n.push("</tr>"),0!=n.length){var h='<table style="font-size:smaller;color:'+K.grid.color+'">'+n.join("")+"</table>";if(null!=K.legend.container)t(K.legend.container).html(h);else{var u="",d=K.legend.position,p=K.legend.margin;null==p[0]&&(p=[p,p]),"n"==d.charAt(0)?u+="top:"+(p[1]+at.top)+"px;":"s"==d.charAt(0)&&(u+="bottom:"+(p[1]+at.bottom)+"px;"),"e"==d.charAt(1)?u+="right:"+(p[0]+at.right)+"px;":"w"==d.charAt(1)&&(u+="left:"+(p[0]+at.left)+"px;");var m=t('<div class="legend">'+h.replace('style="','style="position:absolute;'+u+";")+"</div>").appendTo(e);if(0!=K.legend.backgroundOpacity){var x=K.legend.backgroundColor;null==x&&((x=(x=K.grid.backgroundColor)&&"string"==typeof x?t.color.parse(x):t.color.extract(m,"background-color")).a=1,x=x.toString());var g=m.children();t('<div style="position:absolute;width:'+g.width()+"px;height:"+g.height()+"px;"+u+"background-color:"+x+';"> </div>').prependTo(m).css("opacity",K.legend.backgroundOpacity)}}}}}function R(t,i,e){var o,n,r,a=K.grid.mouseActiveRadius,l=a*a+1,s=null;for(o=$.length-1;o>=0;--o)if(e($[o])){var c=$[o],f=c.xaxis,h=c.yaxis,u=c.datapoints.points,d=f.c2p(t),p=h.c2p(i),m=a/f.scale,x=a/h.scale;if(r=c.datapoints.pointsize,f.options.inverseTransform&&(m=Number.MAX_VALUE),h.options.inverseTransform&&(x=Number.MAX_VALUE),c.lines.show||c.points.show)for(n=0;n<u.length;n+=r){var g=u[n],b=u[n+1];if(null!=g&&!(g-d>m||g-d<-m||b-p>x||b-p<-x)){var v=Math.abs(f.p2c(g)-t),k=Math.abs(h.p2c(b)-i),y=v*v+k*k;y<l&&(l=y,s=[o,n/r])}}if(c.bars.show&&!s){var w="left"==c.bars.align?0:-c.bars.barWidth/2,T=w+c.bars.barWidth;for(n=0;n<u.length;n+=r){var g=u[n],b=u[n+1],M=u[n+2];null!=g&&(($[o].bars.horizontal?d<=Math.max(M,g)&&d>=Math.min(M,g)&&p>=b+w&&p<=b+T:d>=g+w&&d<=g+T&&p>=Math.min(M,b)&&p<=Math.max(M,b))&&(s=[o,n/r]))}}}return s?(o=s[0],n=s[1],r=$[o].datapoints.pointsize,{datapoint:$[o].datapoints.points.slice(n*r,(n+1)*r),dataIndex:n,series:$[o],seriesIndex:o}):null}function j(t){K.grid.hoverable&&G("plothover",t,function(t){return 0!=t.hoverable})}function B(t){K.grid.hoverable&&G("plothover",t,function(t){return!1})}function H(t){G("plotclick",t,function(t){return 0!=t.clickable})}function G(t,i,o){var n=it.offset(),r=i.pageX-n.left-at.left,a=i.pageY-n.top-at.top,l=u({left:r,top:a});l.pageX=i.pageX,l.pageY=i.pageY;var s=R(r,a,o);if(s&&(s.pageX=parseInt(s.series.xaxis.p2c(s.datapoint[0])+n.left+at.left,10),s.pageY=parseInt(s.series.yaxis.p2c(s.datapoint[1])+n.top+at.top,10)),K.grid.autoHighlight){for(var c=0;c<ht.length;++c){var f=ht[c];f.auto!=t||s&&f.series==s.series&&f.point[0]==s.datapoint[0]&&f.point[1]==s.datapoint[1]||Y(f.series,f.point)}s&&X(s.series,s.datapoint,t)}e.trigger(t,[l,s])}function _(){var t=K.interaction.redrawOverlayInterval;-1!=t?ut||(ut=setTimeout(V,t)):V()}function V(){ut=null,ot.save(),tt.clear(),ot.translate(at.left,at.top);var t,i;for(t=0;t<ht.length;++t)(i=ht[t]).series.bars.show?U(i.series,i.point):Q(i.series,i.point);ot.restore(),l(ct.drawOverlay,[ot])}function X(t,i,e){if("number"==typeof t&&(t=$[t]),"number"==typeof i){var o=t.datapoints.pointsize;i=t.datapoints.points.slice(o*i,o*(i+1))}var n=q(t,i);-1==n?(ht.push({series:t,point:i,auto:e}),_()):e||(ht[n].auto=!1)}function Y(t,i){if(null==t&&null==i)return ht=[],void _();if("number"==typeof t&&(t=$[t]),"number"==typeof i){var e=t.datapoints.pointsize;i=t.datapoints.points.slice(e*i,e*(i+1))}var o=q(t,i);-1!=o&&(ht.splice(o,1),_())}function q(t,i){for(var e=0;e<ht.length;++e){var o=ht[e];if(o.series==t&&o.point[0]==i[0]&&o.point[1]==i[1])return e}return-1}function Q(i,e){var o=e[0],n=e[1],r=i.xaxis,a=i.yaxis,l="string"==typeof i.highlightColor?i.highlightColor:t.color.parse(i.color).scale("a",.5).toString();if(!(o<r.min||o>r.max||n<a.min||n>a.max)){var s=i.points.radius+i.points.lineWidth/2;ot.lineWidth=s,ot.strokeStyle=l;var c=1.5*s;o=r.p2c(o),n=a.p2c(n),ot.beginPath(),"circle"==i.points.symbol?ot.arc(o,n,c,0,2*Math.PI,!1):i.points.symbol(ot,o,n,c,!1),ot.closePath(),ot.stroke()}}function U(i,e){var o="string"==typeof i.highlightColor?i.highlightColor:t.color.parse(i.color).scale("a",.5).toString(),n=o,r="left"==i.bars.align?0:-i.bars.barWidth/2;ot.lineWidth=i.bars.lineWidth,ot.strokeStyle=o,D(e[0],e[1],e[2]||0,r,r+i.bars.barWidth,0,function(){return n},i.xaxis,i.yaxis,ot,i.bars.horizontal,i.bars.lineWidth)}function J(i,e,o,n){if("string"==typeof i)return i;for(var r=et.createLinearGradient(0,o,0,e),a=0,l=i.colors.length;a<l;++a){var s=i.colors[a];if("string"!=typeof s){var c=t.color.parse(n);null!=s.brightness&&(c=c.scale("rgb",s.brightness)),null!=s.opacity&&(c.a*=s.opacity),s=c.toString()}r.addColorStop(a/(l-1),s)}return r}var $=[],K={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:!0,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:.85,sorted:null},xaxis:{show:null,position:"bottom",mode:null,font:null,color:null,tickColor:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,reserveSpace:null,tickLength:null,alignTicksWithAxis:null,tickDecimals:null,tickSize:null,minTickSize:null},yaxis:{autoscaleMargin:.02,position:"left"},xaxes:[],yaxes:[],series:{points:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#ffffff",symbol:"circle"},lines:{lineWidth:2,fill:!1,fillColor:null,steps:!1},bars:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,align:"left",horizontal:!1,zero:!0},shadowSize:3,highlightColor:null},grid:{show:!0,aboveData:!1,color:"#545454",backgroundColor:null,borderColor:null,tickColor:null,margin:0,labelMargin:5,axisMargin:8,borderWidth:2,minBorderMargin:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:!1,hoverable:!1,autoHighlight:!0,mouseActiveRadius:10},interaction:{redrawOverlayInterval:1e3/60},hooks:{}},Z=null,tt=null,it=null,et=null,ot=null,nt=[],rt=[],at={left:0,right:0,top:0,bottom:0},lt=0,st=0,ct={processOptions:[],processRawData:[],processDatapoints:[],processOffset:[],drawBackground:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},ft=this;ft.setData=s,ft.setupGrid=y,ft.draw=S,ft.getPlaceholder=function(){return e},ft.getCanvas=function(){return Z.element},ft.getPlotOffset=function(){return at},ft.width=function(){return lt},ft.height=function(){return st},ft.offset=function(){var t=it.offset();return t.left+=at.left,t.top+=at.top,t},ft.getData=function(){return $},ft.getAxes=function(){var i={};return t.each(nt.concat(rt),function(t,e){e&&(i[e.direction+(1!=e.n?e.n:"")+"axis"]=e)}),i},ft.getXAxes=function(){return nt},ft.getYAxes=function(){return rt},ft.c2p=u,ft.p2c=function(t){var i,e,o,n={};for(i=0;i<nt.length;++i)if((e=nt[i])&&e.used&&(o="x"+e.n,null==t[o]&&1==e.n&&(o="x"),null!=t[o])){n.left=e.p2c(t[o]);break}for(i=0;i<rt.length;++i)if((e=rt[i])&&e.used&&(o="y"+e.n,null==t[o]&&1==e.n&&(o="y"),null!=t[o])){n.top=e.p2c(t[o]);break}return n},ft.getOptions=function(){return K},ft.highlight=X,ft.unhighlight=Y,ft.triggerRedrawOverlay=_,ft.pointOffset=function(t){return{left:parseInt(nt[f(t,"x")-1].p2c(+t.x)+at.left,10),top:parseInt(rt[f(t,"y")-1].p2c(+t.y)+at.top,10)}},ft.shutdown=function(){ut&&clearTimeout(ut),it.unbind("mousemove",j),it.unbind("mouseleave",B),it.unbind("click",H),l(ct.shutdown,[it])},ft.resize=function(){var t=e.width(),i=e.height();Z.resize(t,i),tt.resize(t,i)},ft.hooks=ct,function(){for(var e={Canvas:i},o=0;o<a.length;++o){var n=a[o];n.init(ft,e),n.options&&t.extend(!0,K,n.options)}}(),function(i){t.extend(!0,K,i),i&&i.colors&&(K.colors=i.colors),null==K.xaxis.color&&(K.xaxis.color=t.color.parse(K.grid.color).scale("a",.22).toString()),null==K.yaxis.color&&(K.yaxis.color=t.color.parse(K.grid.color).scale("a",.22).toString()),null==K.xaxis.tickColor&&(K.xaxis.tickColor=K.grid.tickColor||K.xaxis.color),null==K.yaxis.tickColor&&(K.yaxis.tickColor=K.grid.tickColor||K.yaxis.color),null==K.grid.borderColor&&(K.grid.borderColor=K.grid.color),null==K.grid.tickColor&&(K.grid.tickColor=t.color.parse(K.grid.color).scale("a",.22).toString());var o,n,r,a={style:e.css("font-style"),size:Math.round(.8*(+e.css("font-size").replace("px","")||13)),variant:e.css("font-variant"),weight:e.css("font-weight"),family:e.css("font-family")};for(a.lineHeight=1.15*a.size,r=K.xaxes.length||1,o=0;o<r;++o)(n=K.xaxes[o])&&!n.tickColor&&(n.tickColor=n.color),n=t.extend(!0,{},K.xaxis,n),K.xaxes[o]=n,n.font&&(n.font=t.extend({},a,n.font),n.font.color||(n.font.color=n.color));for(r=K.yaxes.length||1,o=0;o<r;++o)(n=K.yaxes[o])&&!n.tickColor&&(n.tickColor=n.color),n=t.extend(!0,{},K.yaxis,n),K.yaxes[o]=n,n.font&&(n.font=t.extend({},a,n.font),n.font.color||(n.font.color=n.color));for(K.xaxis.noTicks&&null==K.xaxis.ticks&&(K.xaxis.ticks=K.xaxis.noTicks),K.yaxis.noTicks&&null==K.yaxis.ticks&&(K.yaxis.ticks=K.yaxis.noTicks),K.x2axis&&(K.xaxes[1]=t.extend(!0,{},K.xaxis,K.x2axis),K.xaxes[1].position="top"),K.y2axis&&(K.yaxes[1]=t.extend(!0,{},K.yaxis,K.y2axis),K.yaxes[1].position="right"),K.grid.coloredAreas&&(K.grid.markings=K.grid.coloredAreas),K.grid.coloredAreasColor&&(K.grid.markingsColor=K.grid.coloredAreasColor),K.lines&&t.extend(!0,K.series.lines,K.lines),K.points&&t.extend(!0,K.series.points,K.points),K.bars&&t.extend(!0,K.series.bars,K.bars),null!=K.shadowSize&&(K.series.shadowSize=K.shadowSize),null!=K.highlightColor&&(K.series.highlightColor=K.highlightColor),o=0;o<K.xaxes.length;++o)d(nt,o+1).options=K.xaxes[o];for(o=0;o<K.yaxes.length;++o)d(rt,o+1).options=K.yaxes[o];for(var s in ct)K.hooks[s]&&K.hooks[s].length&&(ct[s]=ct[s].concat(K.hooks[s]));l(ct.processOptions,[K])}(r),function(){e.css("padding",0).children(":not(.flot-base,.flot-overlay)").remove(),"static"==e.css("position")&&e.css("position","relative"),Z=new i("flot-base",e),tt=new i("flot-overlay",e),et=Z.context,ot=tt.context,it=t(tt.element).unbind();var o=e.data("plot");o&&(o.shutdown(),tt.clear()),e.data("plot",ft)}(),s(n),y(),S(),K.grid.hoverable&&(it.mousemove(j),it.bind("mouseleave",B)),K.grid.clickable&&it.click(H),l(ct.bindEvents,[it]);var ht=[],ut=null}function o(t,i){return i*Math.floor(t/i)}var n=Object.prototype.hasOwnProperty;i.prototype.resize=function(t,i){if(t<=0||i<=0)throw new Error("Invalid dimensions for plot, width = "+t+", height = "+i);var e=this.element,o=this.context,n=this.pixelRatio;this.width!=t&&(e.width=t*n,e.style.width=t+"px",this.width=t),this.height!=i&&(e.height=i*n,e.style.height=i+"px",this.height=i),o.restore(),o.save(),o.scale(n,n)},i.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},i.prototype.render=function(){var t=this._textCache;for(var i in t)if(n.call(t,i)){var e=this.getTextLayer(i),o=t[i];e.hide();for(var r in o)if(n.call(o,r)){var a=o[r];for(var l in a)if(n.call(a,l)){for(var s,c=a[l].positions,f=0;s=c[f];f++)s.active?s.rendered||(e.append(s.element),s.rendered=!0):(c.splice(f--,1),s.rendered&&s.element.detach());0==c.length&&delete a[l]}}e.show()}},i.prototype.getTextLayer=function(i){var e=this.text[i];return null==e&&(null==this.textContainer&&(this.textContainer=t("<div class='flot-text'></div>").css({position:"absolute",top:0,left:0,bottom:0,right:0,"font-size":"smaller",color:"#545454"}).insertAfter(this.element)),e=this.text[i]=t("<div></div>").addClass(i).css({position:"absolute",top:0,left:0,bottom:0,right:0}).appendTo(this.textContainer)),e},i.prototype.getTextInfo=function(i,e,o,n,r){var a,l,s,c;if(e=""+e,a="object"==typeof o?o.style+" "+o.variant+" "+o.weight+" "+o.size+"px/"+o.lineHeight+"px "+o.family:o,null==(l=this._textCache[i])&&(l=this._textCache[i]={}),null==(s=l[a])&&(s=l[a]={}),null==(c=s[e])){var f=t("<div></div>").html(e).css({position:"absolute","max-width":r,top:-9999}).appendTo(this.getTextLayer(i));"object"==typeof o?f.css({font:a,color:o.color}):"string"==typeof o&&f.addClass(o),c=s[e]={width:f.outerWidth(!0),height:f.outerHeight(!0),element:f,positions:[]},f.detach()}return c},i.prototype.addText=function(t,i,e,o,n,r,a,l,s){var c=this.getTextInfo(t,o,n,r,a),f=c.positions;"center"==l?i-=c.width/2:"right"==l&&(i-=c.width),"middle"==s?e-=c.height/2:"bottom"==s&&(e-=c.height);for(var h,u=0;h=f[u];u++)if(h.x==i&&h.y==e)return void(h.active=!0);h={active:!0,rendered:!1,element:f.length?c.element.clone():c.element,x:i,y:e},f.push(h),h.element.css({top:Math.round(e),left:Math.round(i),"text-align":l})},i.prototype.removeText=function(t,i,e,o,r,a){if(null==o){var l=this._textCache[t];if(null!=l)for(var s in l)if(n.call(l,s)){var c=l[s];for(var f in c)if(n.call(c,f))for(var h=c[f].positions,u=0;d=h[u];u++)d.active=!1}}else for(var d,h=this.getTextInfo(t,o,r,a).positions,u=0;d=h[u];u++)d.x==i&&d.y==e&&(d.active=!1)},t.plot=function(i,o,n){return new e(t(i),o,n,t.plot.plugins)},t.plot.version="0.8.1",t.plot.plugins=[],t.fn.plot=function(i,e){return this.each(function(){t.plot(this,i,e)})}}(jQuery);