laipower/wp-content/plugins/easy-digital-downloads/assets/js/vendor/jquery.flot.min.js

1 line
32 KiB
JavaScript

!function(t){t.color={},t.color.make=function(i,e,n,o){var a={};return a.r=i||0,a.g=e||0,a.b=n||0,a.a=null!=o?o:1,a.add=function(t,i){for(var e=0;e<t.length;++e)a[t.charAt(e)]+=i;return a.normalize()},a.scale=function(t,i){for(var e=0;e<t.length;++e)a[t.charAt(e)]*=i;return a.normalize()},a.toString=function(){return a.a>=1?"rgb("+[a.r,a.g,a.b].join(",")+")":"rgba("+[a.r,a.g,a.b,a.a].join(",")+")"},a.normalize=function(){function t(t,i,e){return i<t?t:i>e?e:i}return a.r=t(0,parseInt(a.r),255),a.g=t(0,parseInt(a.g),255),a.b=t(0,parseInt(a.b),255),a.a=t(0,a.a,1),a},a.clone=function(){return t.color.make(a.r,a.b,a.g,a.a)},a.normalize()},t.color.extract=function(i,e){var n;do{if(""!=(n=i.css(e).toLowerCase())&&"transparent"!=n)break;i=i.parent()}while(!t.nodeName(i.get(0),"body"));return"rgba(0, 0, 0, 0)"==n&&(n="transparent"),t.color.parse(n)},t.color.parse=function(e){var n,o=t.color.make;if(n=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e))return o(parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10));if(n=/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 o(parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10),parseFloat(n[4]));if(n=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e))return o(2.55*parseFloat(n[1]),2.55*parseFloat(n[2]),2.55*parseFloat(n[3]));if(n=/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 o(2.55*parseFloat(n[1]),2.55*parseFloat(n[2]),2.55*parseFloat(n[3]),parseFloat(n[4]));if(n=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e))return o(parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16));if(n=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e))return o(parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16));var a=t.trim(e).toLowerCase();return"transparent"==a?o(255,255,255,0):o((n=i[a]||[0,0,0])[0],n[1],n[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,n,o){var a=[],r={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,timezone: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,monthNames:null,timeformat:null,twelveHourClock:!1},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:{}},l=null,s=null,c=null,h=null,f=null,u=[],d=[],p={left:0,right:0,top:0,bottom:0},m=0,g=0,x=0,b=0,v={processOptions:[],processRawData:[],processDatapoints:[],processOffset:[],drawBackground:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},k=this;function y(t,i){i=[k].concat(i);for(var e=0;e<t.length;++e)t[e].apply(this,i)}function w(i){a=function(i){for(var e=[],n=0;n<i.length;++n){var o=t.extend(!0,{},r.series);null!=i[n].data?(o.data=i[n].data,delete i[n].data,t.extend(!0,o,i[n]),i[n].data=o.data):o.data=i[n],e.push(o)}return e}(i),function(){var i,e=a.length,n=-1;for(i=0;i<a.length;++i){var o=a[i].color;null!=o&&(e--,"number"==typeof o&&o>n&&(n=o))}e<=n&&(e=n+1);var l,s=[],c=r.colors,h=c.length,f=0;for(i=0;i<e;i++)l=t.color.parse(c[i%h]||"#666"),i%h==0&&i&&(f=f>=0?f<.5?-f-.2:0:-f),s[i]=l.scale("rgb",1+f);var p,m=0;for(i=0;i<a.length;++i){if(null==(p=a[i]).color?(p.color=s[m].toString(),++m):"number"==typeof p.color&&(p.color=s[p.color].toString()),null==p.lines.show){var g,x=!0;for(g in p)if(p[g]&&p[g].show){x=!1;break}x&&(p.lines.show=!0)}null==p.lines.zero&&(p.lines.zero=!!p.lines.fill),p.xaxis=C(u,M(p,"x")),p.yaxis=C(d,M(p,"y"))}}(),function(){var i,e,n,o,r,l,s,c,h,f,u,d,p=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=Number.MAX_VALUE;function x(t,i,e){i<t.datamin&&i!=-g&&(t.datamin=i),e>t.datamax&&e!=g&&(t.datamax=e)}for(t.each(T(),(function(t,i){i.datamin=p,i.datamax=m,i.used=!1})),i=0;i<a.length;++i)(r=a[i]).datapoints={points:[]},y(v.processRawData,[r,r.data,r.datapoints]);for(i=0;i<a.length;++i){if(u=(r=a[i]).data,!(d=r.datapoints.format)){if((d=[]).push({x:!0,number:!0,required:!0}),d.push({y:!0,number:!0,required:!0}),r.bars.show||r.lines.show&&r.lines.fill){var b=!!(r.bars.show&&r.bars.zero||r.lines.show&&r.lines.zero);d.push({y:!0,number:!0,required:!1,defaultValue:0,autoscale:b}),r.bars.horizontal&&(delete d[d.length-1].y,d[d.length-1].x=!0)}r.datapoints.format=d}if(null==r.datapoints.pointsize){r.datapoints.pointsize=d.length,s=r.datapoints.pointsize,l=r.datapoints.points;var k=r.lines.show&&r.lines.steps;for(r.xaxis.used=r.yaxis.used=!0,e=n=0;e<u.length;++e,n+=s){var w=null==(f=u[e]);if(!w)for(o=0;o<s;++o)c=f[o],(h=d[o])&&(h.number&&null!=c&&(c=+c,isNaN(c)?c=null:c==1/0?c=g:c==-1/0&&(c=-g)),null==c&&(h.required&&(w=!0),null!=h.defaultValue&&(c=h.defaultValue))),l[n+o]=c;if(w)for(o=0;o<s;++o)null!=(c=l[n+o])&&((h=d[o]).x&&x(r.xaxis,c,c),h.y&&x(r.yaxis,c,c)),l[n+o]=null;else if(k&&n>0&&null!=l[n-s]&&l[n-s]!=l[n]&&l[n-s+1]!=l[n+1]){for(o=0;o<s;++o)l[n+s+o]=l[n+o];l[n+1]=l[n-s+1],n+=s}}}}for(i=0;i<a.length;++i)r=a[i],y(v.processDatapoints,[r,r.datapoints]);for(i=0;i<a.length;++i){l=(r=a[i]).datapoints.points,s=r.datapoints.pointsize,d=r.datapoints.format;var M=p,S=p,C=m,W=m;for(e=0;e<l.length;e+=s)if(null!=l[e])for(o=0;o<s;++o)c=l[e+o],(h=d[o])&&!1!==h.autoscale&&c!=g&&c!=-g&&(h.x&&(c<M&&(M=c),c>C&&(C=c)),h.y&&(c<S&&(S=c),c>W&&(W=c)));if(r.bars.show){var z;switch(r.bars.align){case"left":z=0;break;case"right":z=-r.bars.barWidth;break;case"center":z=-r.bars.barWidth/2;break;default:throw new Error("Invalid bar alignment: "+r.bars.align)}r.bars.horizontal?(S+=z,W+=z+r.bars.barWidth):(M+=z,C+=z+r.bars.barWidth)}x(r.xaxis,M,C),x(r.yaxis,S,W)}t.each(T(),(function(t,i){i.datamin==p&&(i.datamin=null),i.datamax==m&&(i.datamax=null)}))}()}function M(t,i){var e=t[i+"axis"];return"object"==typeof e&&(e=e.n),"number"!=typeof e&&(e=1),e}function T(){return t.grep(u.concat(d),(function(t){return t}))}function S(t){var i,e,n={};for(i=0;i<u.length;++i)(e=u[i])&&e.used&&(n["x"+e.n]=e.c2p(t.left));for(i=0;i<d.length;++i)(e=d[i])&&e.used&&(n["y"+e.n]=e.c2p(t.top));return void 0!==n.x1&&(n.x=n.x1),void 0!==n.y1&&(n.y=n.y1),n}function C(i,e){return i[e-1]||(i[e-1]={n:e,direction:i==u?"x":"y",options:t.extend(!0,{},i==u?r.xaxis:r.yaxis)}),i[e-1]}function W(t){return(window.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)}function z(e){var n=document.createElement("canvas");if(n.className=e,t(n).css({direction:"ltr",position:"absolute",left:0,top:0}).appendTo(i),!n.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.");n=window.G_vmlCanvasManager.initElement(n)}var o=n.getContext("2d"),a=W(o);return n.width=m*a,n.height=g*a,n.style.width=m+"px",n.style.height=g+"px",o.save(),o.scale(a,a),n}function I(){if(m=i.width(),g=i.height(),m<=0||g<=0)throw new Error("Invalid dimensions for plot, width = "+m+", height = "+g)}function A(t){var i=t.getContext("2d"),e=W(i);t.style.width!=m&&(t.width=m*e,t.style.width=m+"px"),t.style.height!=g&&(t.height=g*e,t.style.height=g+"px"),i.restore(),i.save(),i.scale(e,e)}function F(i){var e,n=i.labelWidth,o=i.labelHeight,a=i.options.position,l=i.options.tickLength,s=r.grid.axisMargin,c=r.grid.labelMargin,h="x"==i.direction?u:d,f=t.grep(h,(function(t){return t&&t.options.position==a&&t.reserveSpace}));if(t.inArray(i,f)==f.length-1&&(s=0),null==l){var x=t.grep(h,(function(t){return t&&t.reserveSpace}));l=(e=0==t.inArray(i,x))?"full":5}isNaN(+l)||(c+=+l),"x"==i.direction?(o+=c,"bottom"==a?(p.bottom+=o+s,i.box={top:g-p.bottom,height:o}):(i.box={top:p.top+s,height:o},p.top+=o+s)):(n+=c,"left"==a?(i.box={left:p.left+s,width:n},p.left+=n+s):(p.right+=n+s,i.box={left:m-p.right,width:n})),i.position=a,i.tickLength=l,i.box.padding=c,i.innermost=e}function P(){var e,n=T(),o=r.grid.show;for(var l in p){var s=r.grid.margin||0;p[l]="number"==typeof s?s:s[l]||0}for(var l in y(v.processOffset,[p]),p)"object"==typeof r.grid.borderWidth?p[l]+=o?r.grid.borderWidth[l]:0:p[l]+=o?r.grid.borderWidth:0;if(t.each(n,(function(t,i){i.show=i.options.show,null==i.show&&(i.show=i.used),i.reserveSpace=i.show||i.options.reserveSpace,function(t){var i=t.options,e=+(null!=i.min?i.min:t.datamin),n=+(null!=i.max?i.max:t.datamax),o=n-e;if(0==o){var a=0==n?1:.01;null==i.min&&(e-=a),null!=i.max&&null==i.min||(n+=a)}else{var r=i.autoscaleMargin;null!=r&&(null==i.min&&(e-=o*r)<0&&null!=t.datamin&&t.datamin>=0&&(e=0),null==i.max&&(n+=o*r)>0&&null!=t.datamax&&t.datamax<=0&&(n=0))}t.min=e,t.max=n}(i)})),o){var c={style:i.css("font-style"),size:Math.round(.8*(+i.css("font-size").replace("px","")||13)),variant:i.css("font-variant"),weight:i.css("font-weight"),family:i.css("font-family")},f=t.grep(n,(function(t){return t.reserveSpace}));for(t.each(f,(function(i,e){!function(i){var e,n=i.options;if(e="number"==typeof n.ticks&&n.ticks>0?n.ticks:.3*Math.sqrt("x"==i.direction?m:g),i.delta=(i.max-i.min)/e,"time"==n.mode&&!i.tickGenerator)throw new Error("Time mode requires the flot.time plugin.");if(i.tickGenerator||(i.tickGenerator=function(t){var i=n.tickDecimals,e=-Math.floor(Math.log(t.delta)/Math.LN10);null!=i&&e>i&&(e=i);var o,a,r,l,s,c=Math.pow(10,-e),h=t.delta/c,f=[],u=0,d=Number.NaN;h<1.5?o=1:h<3?(o=2,h>2.25&&(null==i||e+1<=i)&&(o=2.5,++e)):o=h<7.5?5:10,o*=c,null!=n.minTickSize&&o<n.minTickSize&&(o=n.minTickSize),t.tickDecimals=Math.max(0,null!=i?i:e),t.tickSize=n.tickSize||o,l=t.min,a=(s=t.tickSize)*Math.floor(l/s);do{r=d,d=a+u*t.tickSize,f.push(d),++u}while(d<t.max&&d!=r);return f},i.tickFormatter=function(t,i){var e=i.tickDecimals?Math.pow(10,i.tickDecimals):1,n=""+Math.round(t*e)/e;if(null!=i.tickDecimals){var o=n.indexOf("."),a=-1==o?0:n.length-o-1;if(a<i.tickDecimals)return(a?n:n+".")+(""+e).substr(1,i.tickDecimals-a)}return n}),t.isFunction(n.tickFormatter)&&(i.tickFormatter=function(t,i){return""+n.tickFormatter(t,i)}),null!=n.alignTicksWithAxis){var o=("x"==i.direction?u:d)[n.alignTicksWithAxis-1];if(o&&o.used&&o!=i){var a=i.tickGenerator(i);if(a.length>0&&(null==n.min&&(i.min=Math.min(i.min,a[0])),null==n.max&&a.length>1&&(i.max=Math.max(i.max,a[a.length-1]))),i.tickGenerator=function(t){var i,e,n=[];for(e=0;e<o.ticks.length;++e)i=(o.ticks[e].v-o.min)/(o.max-o.min),i=t.min+i*(t.max-t.min),n.push(i);return n},!i.mode&&null==n.tickDecimals){var r=Math.max(0,1-Math.floor(Math.log(i.delta)/Math.LN10)),l=i.tickGenerator(i);l.length>1&&/\..*0$/.test((l[1]-l[0]).toFixed(r))||(i.tickDecimals=r)}}}}(e),function(i){var e,n,o=i.options.ticks,a=[];for(null==o||"number"==typeof o&&o>0?a=i.tickGenerator(i):o&&(a=t.isFunction(o)?o(i):o),i.ticks=[],e=0;e<a.length;++e){var r=null,l=a[e];"object"==typeof l?(n=+l[0],l.length>1&&(r=l[1])):n=+l,null==r&&(r=i.tickFormatter(n,i)),isNaN(n)||i.ticks.push({v:n,label:r})}}(e),function(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)))}(e,e.ticks),e.font=t.extend({},c,e.options.font),function(t){var i=t.options,e=t.ticks||[],n=i.labelWidth||0,o=i.labelHeight||0,a=t.font;h.save(),h.font=a.style+" "+a.variant+" "+a.weight+" "+a.size+"px '"+a.family+"'";for(var r=0;r<e.length;++r){var l=e[r];if(l.lines=[],l.width=l.height=0,l.label){for(var s=(l.label+"").replace(/<br ?\/?>|\r\n|\r/g,"\n").split("\n"),c=0;c<s.length;++c){var f={text:s[c]},u=h.measureText(f.text);f.width=u.width,f.height=null!=u.height?u.height:a.size,f.height+=Math.round(.15*a.size),l.width=Math.max(f.width,l.width),l.height+=f.height,l.lines.push(f)}null==i.labelWidth&&(n=Math.max(n,l.width)),null==i.labelHeight&&(o=Math.max(o,l.height))}}h.restore(),t.labelWidth=Math.ceil(n),t.labelHeight=Math.ceil(o)}(e)})),e=f.length-1;e>=0;--e)F(f[e]);!function(){var i,e=r.grid.minBorderMargin,n={x:0,y:0};if(null==e)for(e=0,i=0;i<a.length;++i)e=Math.max(e,2*(a[i].points.radius+a[i].points.lineWidth/2));n.x=n.y=Math.ceil(e),t.each(T(),(function(t,i){var e=i.direction;i.reserveSpace&&(n[e]=Math.ceil(Math.max(n[e],("x"==e?i.labelWidth:i.labelHeight)/2)))})),p.left=Math.max(n.x,p.left),p.right=Math.max(n.x,p.right),p.top=Math.max(n.y,p.top),p.bottom=Math.max(n.y,p.bottom)}(),t.each(f,(function(t,i){!function(t){"x"==t.direction?(t.box.left=p.left-t.labelWidth/2,t.box.width=m-p.left-p.right+t.labelWidth):(t.box.top=p.top-t.labelHeight/2,t.box.height=g-p.bottom-p.top+t.labelHeight)}(i)}))}x=m-p.left-p.right,b=g-p.bottom-p.top,t.each(n,(function(t,i){!function(t){function i(t){return t}var e,n,o=t.options.transform||i,a=t.options.inverseTransform;"x"==t.direction?(e=t.scale=x/Math.abs(o(t.max)-o(t.min)),n=Math.min(o(t.max),o(t.min))):(e=-(e=t.scale=b/Math.abs(o(t.max)-o(t.min))),n=Math.max(o(t.max),o(t.min))),t.p2c=o==i?function(t){return(t-n)*e}:function(t){return(o(t)-n)*e},t.c2p=a?function(t){return a(n+t/e)}:function(t){return n+t/e}}(i)})),function(){if(i.find(".legend").remove(),r.legend.show){for(var e,n,o=[],l=[],s=!1,c=r.legend.labelFormatter,h=0;h<a.length;++h)(e=a[h]).label&&(n=c?c(e.label,e):e.label)&&l.push({label:n,color:e.color});if(r.legend.sorted)if(t.isFunction(r.legend.sorted))l.sort(r.legend.sorted);else if("reverse"==r.legend.sorted)l.reverse();else{var f="descending"!=r.legend.sorted;l.sort((function(t,i){return t.label==i.label?0:t.label<i.label!=f?1:-1}))}for(h=0;h<l.length;++h){var u=l[h];h%r.legend.noColumns==0&&(s&&o.push("</tr>"),o.push("<tr>"),s=!0),o.push('<td class="legendColorBox"><div style="border:1px solid '+r.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+u.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+u.label+"</td>")}if(s&&o.push("</tr>"),0!=o.length){var d='<table style="font-size:smaller;color:'+r.grid.color+'">'+o.join("")+"</table>";if(null!=r.legend.container)t(r.legend.container).html(d);else{var m="",g=r.legend.position,x=r.legend.margin;null==x[0]&&(x=[x,x]),"n"==g.charAt(0)?m+="top:"+(x[1]+p.top)+"px;":"s"==g.charAt(0)&&(m+="bottom:"+(x[1]+p.bottom)+"px;"),"e"==g.charAt(1)?m+="right:"+(x[0]+p.right)+"px;":"w"==g.charAt(1)&&(m+="left:"+(x[0]+p.left)+"px;");var b=t('<div class="legend">'+d.replace('style="','style="position:absolute;'+m+";")+"</div>").appendTo(i);if(0!=r.legend.backgroundOpacity){var v=r.legend.backgroundColor;null==v&&((v=(v=r.grid.backgroundColor)&&"string"==typeof v?t.color.parse(v):t.color.extract(b,"background-color")).a=1,v=v.toString());var k=b.children();t('<div style="position:absolute;width:'+k.width()+"px;height:"+k.height()+"px;"+m+"background-color:"+v+';"> </div>').prependTo(b).css("opacity",r.legend.backgroundOpacity)}}}}}()}function N(){h.clearRect(0,0,m,g),y(v.drawBackground,[h]);var t=r.grid;t.show&&t.backgroundColor&&(h.save(),h.translate(p.left,p.top),h.fillStyle=Z(r.grid.backgroundColor,b,0,"rgba(255, 255, 255, 0)"),h.fillRect(0,0,x,b),h.restore()),t.show&&!t.aboveData&&(E(),O());for(var i=0;i<a.length;++i)y(v.drawSeries,[h,a[i]]),R(a[i]);y(v.draw,[h]),t.show&&t.aboveData&&(E(),O())}function D(t,i){for(var e,n,o,a,r=T(),l=0;l<r.length;++l)if((e=r[l]).direction==i&&(t[a=i+e.n+"axis"]||1!=e.n||(a=i+"axis"),t[a])){n=t[a].from,o=t[a].to;break}if(t[a]||(e="x"==i?u[0]:d[0],n=t[i+"1"],o=t[i+"2"]),null!=n&&null!=o&&n>o){var s=n;n=o,o=s}return{from:n,to:o,axis:e}}function E(){var i,e,n,o;h.save(),h.translate(p.left,p.top);var a=r.grid.markings;if(a)for(t.isFunction(a)&&((e=k.getAxes()).xmin=e.xaxis.min,e.xmax=e.xaxis.max,e.ymin=e.yaxis.min,e.ymax=e.yaxis.max,a=a(e)),i=0;i<a.length;++i){var l=a[i],s=D(l,"x"),c=D(l,"y");null==s.from&&(s.from=s.axis.min),null==s.to&&(s.to=s.axis.max),null==c.from&&(c.from=c.axis.min),null==c.to&&(c.to=c.axis.max),s.to<s.axis.min||s.from>s.axis.max||c.to<c.axis.min||c.from>c.axis.max||(s.from=Math.max(s.from,s.axis.min),s.to=Math.min(s.to,s.axis.max),c.from=Math.max(c.from,c.axis.min),c.to=Math.min(c.to,c.axis.max),s.from==s.to&&c.from==c.to||(s.from=s.axis.p2c(s.from),s.to=s.axis.p2c(s.to),c.from=c.axis.p2c(c.from),c.to=c.axis.p2c(c.to),s.from==s.to||c.from==c.to?(h.beginPath(),h.strokeStyle=l.color||r.grid.markingsColor,h.lineWidth=l.lineWidth||r.grid.markingsLineWidth,h.moveTo(s.from,c.from),h.lineTo(s.to,c.to),h.stroke()):(h.fillStyle=l.color||r.grid.markingsColor,h.fillRect(s.from,c.to,s.to-s.from,c.from-c.to))))}e=T(),n=r.grid.borderWidth;for(var f=0;f<e.length;++f){var u,d,m,g,v=e[f],y=v.box,w=v.tickLength;if(v.show&&0!=v.ticks.length){for(h.strokeStyle=v.options.tickColor||t.color.parse(v.options.color).scale("a",.22).toString(),h.lineWidth=1,"x"==v.direction?(u=0,d="full"==w?"top"==v.position?0:b:y.top-p.top+("top"==v.position?y.height:0)):(d=0,u="full"==w?"left"==v.position?0:x:y.left-p.left+("left"==v.position?y.width:0)),v.innermost||(h.beginPath(),m=g=0,"x"==v.direction?m=x:g=b,1==h.lineWidth&&(u=Math.floor(u)+.5,d=Math.floor(d)+.5),h.moveTo(u,d),h.lineTo(u+m,d+g),h.stroke()),h.beginPath(),i=0;i<v.ticks.length;++i){var M=v.ticks[i].v;m=g=0,isNaN(M)||M<v.min||M>v.max||"full"==w&&("object"==typeof n&&n[v.position]>0||n>0)&&(M==v.min||M==v.max)||("x"==v.direction?(u=v.p2c(M),g="full"==w?-b:w,"top"==v.position&&(g=-g)):(d=v.p2c(M),m="full"==w?-x:w,"left"==v.position&&(m=-m)),1==h.lineWidth&&("x"==v.direction?u=Math.floor(u)+.5:d=Math.floor(d)+.5),h.moveTo(u,d),h.lineTo(u+m,d+g))}h.stroke()}}n&&(o=r.grid.borderColor,"object"==typeof n||"object"==typeof o?("object"!=typeof n&&(n={top:n,right:n,bottom:n,left:n}),"object"!=typeof o&&(o={top:o,right:o,bottom:o,left:o}),n.top>0&&(h.strokeStyle=o.top,h.lineWidth=n.top,h.beginPath(),h.moveTo(0-n.left,0-n.top/2),h.lineTo(x,0-n.top/2),h.stroke()),n.right>0&&(h.strokeStyle=o.right,h.lineWidth=n.right,h.beginPath(),h.moveTo(x+n.right/2,0-n.top),h.lineTo(x+n.right/2,b),h.stroke()),n.bottom>0&&(h.strokeStyle=o.bottom,h.lineWidth=n.bottom,h.beginPath(),h.moveTo(x+n.right,b+n.bottom/2),h.lineTo(0,b+n.bottom/2),h.stroke()),n.left>0&&(h.strokeStyle=o.left,h.lineWidth=n.left,h.beginPath(),h.moveTo(0-n.left/2,b+n.bottom),h.lineTo(0-n.left/2,0),h.stroke())):(h.lineWidth=n,h.strokeStyle=r.grid.borderColor,h.strokeRect(-n/2,-n/2,x+n,b+n))),h.restore()}function O(){h.save(),t.each(T(),(function(t,i){if(i.show&&0!=i.ticks.length){var e=i.box,n=i.font;h.fillStyle=i.options.color,h.font=n.style+" "+n.variant+" "+n.weight+" "+n.size+"px "+n.family,h.textAlign="start",h.textBaseline="middle";for(var o=0;o<i.ticks.length;++o){var a=i.ticks[o];if(!(!a.label||a.v<i.min||a.v>i.max))for(var r,l,s,c=0,f=0;f<a.lines.length;++f)s=a.lines[f],"x"==i.direction?(r=p.left+i.p2c(a.v)-s.width/2,l="bottom"==i.position?e.top+e.padding:e.top+e.height-e.padding-a.height):(l=p.top+i.p2c(a.v)-a.height/2,r="left"==i.position?e.left+e.width-e.padding-s.width:e.left+e.padding),l+=s.height/2+c,c+=s.height,window.opera&&window.opera.version().split(".")[0]<12&&(r=Math.floor(r),l=Math.ceil(l-2)),h.fillText(s.text,r,l)}}})),h.restore()}function R(t){t.lines.show&&function(t){function i(t,i,e,n,o){var a=t.points,r=t.pointsize,l=null,s=null;h.beginPath();for(var c=r;c<a.length;c+=r){var f=a[c-r],u=a[c-r+1],d=a[c],p=a[c+1];if(null!=f&&null!=d){if(u<=p&&u<o.min){if(p<o.min)continue;f=(o.min-u)/(p-u)*(d-f)+f,u=o.min}else if(p<=u&&p<o.min){if(u<o.min)continue;d=(o.min-u)/(p-u)*(d-f)+f,p=o.min}if(u>=p&&u>o.max){if(p>o.max)continue;f=(o.max-u)/(p-u)*(d-f)+f,u=o.max}else if(p>=u&&p>o.max){if(u>o.max)continue;d=(o.max-u)/(p-u)*(d-f)+f,p=o.max}if(f<=d&&f<n.min){if(d<n.min)continue;u=(n.min-f)/(d-f)*(p-u)+u,f=n.min}else if(d<=f&&d<n.min){if(f<n.min)continue;p=(n.min-f)/(d-f)*(p-u)+u,d=n.min}if(f>=d&&f>n.max){if(d>n.max)continue;u=(n.max-f)/(d-f)*(p-u)+u,f=n.max}else if(d>=f&&d>n.max){if(f>n.max)continue;p=(n.max-f)/(d-f)*(p-u)+u,d=n.max}f==l&&u==s||h.moveTo(n.p2c(f)+i,o.p2c(u)+e),l=d,s=p,h.lineTo(n.p2c(d)+i,o.p2c(p)+e)}}h.stroke()}h.save(),h.translate(p.left,p.top),h.lineJoin="round";var e=t.lines.lineWidth,n=t.shadowSize;if(e>0&&n>0){h.lineWidth=n,h.strokeStyle="rgba(0,0,0,0.1)";var o=Math.PI/18;i(t.datapoints,Math.sin(o)*(e/2+n/2),Math.cos(o)*(e/2+n/2),t.xaxis,t.yaxis),h.lineWidth=n/2,i(t.datapoints,Math.sin(o)*(e/2+n/4),Math.cos(o)*(e/2+n/4),t.xaxis,t.yaxis)}h.lineWidth=e,h.strokeStyle=t.color;var a=B(t.lines,t.color,0,b);a&&(h.fillStyle=a,function(t,i,e){for(var n=t.points,o=t.pointsize,a=Math.min(Math.max(0,e.min),e.max),r=0,l=!1,s=1,c=0,f=0;!(o>0&&r>n.length+o);){var u=n[(r+=o)-o],d=n[r-o+s],p=n[r],m=n[r+s];if(l){if(o>0&&null!=u&&null==p){f=r,o=-o,s=2;continue}if(o<0&&r==c+o){h.fill(),l=!1,s=1,r=c=f+(o=-o);continue}}if(null!=u&&null!=p){if(u<=p&&u<i.min){if(p<i.min)continue;d=(i.min-u)/(p-u)*(m-d)+d,u=i.min}else if(p<=u&&p<i.min){if(u<i.min)continue;m=(i.min-u)/(p-u)*(m-d)+d,p=i.min}if(u>=p&&u>i.max){if(p>i.max)continue;d=(i.max-u)/(p-u)*(m-d)+d,u=i.max}else if(p>=u&&p>i.max){if(u>i.max)continue;m=(i.max-u)/(p-u)*(m-d)+d,p=i.max}if(l||(h.beginPath(),h.moveTo(i.p2c(u),e.p2c(a)),l=!0),d>=e.max&&m>=e.max)h.lineTo(i.p2c(u),e.p2c(e.max)),h.lineTo(i.p2c(p),e.p2c(e.max));else if(d<=e.min&&m<=e.min)h.lineTo(i.p2c(u),e.p2c(e.min)),h.lineTo(i.p2c(p),e.p2c(e.min));else{var g=u,x=p;d<=m&&d<e.min&&m>=e.min?(u=(e.min-d)/(m-d)*(p-u)+u,d=e.min):m<=d&&m<e.min&&d>=e.min&&(p=(e.min-d)/(m-d)*(p-u)+u,m=e.min),d>=m&&d>e.max&&m<=e.max?(u=(e.max-d)/(m-d)*(p-u)+u,d=e.max):m>=d&&m>e.max&&d<=e.max&&(p=(e.max-d)/(m-d)*(p-u)+u,m=e.max),u!=g&&h.lineTo(i.p2c(g),e.p2c(d)),h.lineTo(i.p2c(u),e.p2c(d)),h.lineTo(i.p2c(p),e.p2c(m)),p!=x&&(h.lineTo(i.p2c(p),e.p2c(m)),h.lineTo(i.p2c(x),e.p2c(m)))}}}}(t.datapoints,t.xaxis,t.yaxis)),e>0&&i(t.datapoints,0,0,t.xaxis,t.yaxis),h.restore()}(t),t.bars.show&&function(t){var i;switch(h.save(),h.translate(p.left,p.top),h.lineWidth=t.bars.lineWidth,h.strokeStyle=t.color,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 B(t.bars,t.color,i,e)}:null;(function(i,e,n,o,a,r,l){for(var s=i.points,c=i.pointsize,f=0;f<s.length;f+=c)null!=s[f]&&L(s[f],s[f+1],s[f+2],e,n,0,a,r,l,h,t.bars.horizontal,t.bars.lineWidth)})(t.datapoints,i,i+t.bars.barWidth,0,e,t.xaxis,t.yaxis),h.restore()}(t),t.points.show&&function(t){function i(t,i,e,n,o,a,r,l){for(var s=t.points,c=t.pointsize,f=0;f<s.length;f+=c){var u=s[f],d=s[f+1];null==u||u<a.min||u>a.max||d<r.min||d>r.max||(h.beginPath(),u=a.p2c(u),d=r.p2c(d)+n,"circle"==l?h.arc(u,d,i,0,o?Math.PI:2*Math.PI,!1):l(h,u,d,i,o),h.closePath(),e&&(h.fillStyle=e,h.fill()),h.stroke())}}h.save(),h.translate(p.left,p.top);var e=t.points.lineWidth,n=t.shadowSize,o=t.points.radius,a=t.points.symbol;if(0==e&&(e=1e-4),e>0&&n>0){var r=n/2;h.lineWidth=r,h.strokeStyle="rgba(0,0,0,0.1)",i(t.datapoints,o,null,r+r/2,!0,t.xaxis,t.yaxis,a),h.strokeStyle="rgba(0,0,0,0.2)",i(t.datapoints,o,null,r/2,!0,t.xaxis,t.yaxis,a)}h.lineWidth=e,h.strokeStyle=t.color,i(t.datapoints,o,B(t.points,t.color),0,!1,t.xaxis,t.yaxis,a),h.restore()}(t)}function L(t,i,e,n,o,a,r,l,s,c,h,f){var u,d,p,m,g,x,b,v,k;h?(v=x=b=!0,g=!1,m=i+n,p=i+o,(d=t)<(u=e)&&(k=d,d=u,u=k,g=!0,x=!1)):(g=x=b=!0,v=!1,u=t+n,d=t+o,(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,g=!1),d>l.max&&(d=l.max,x=!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),r&&(c.beginPath(),c.moveTo(u,p),c.lineTo(u,m),c.lineTo(d,m),c.lineTo(d,p),c.fillStyle=r(p,m),c.fill()),f>0&&(g||x||b||v)&&(c.beginPath(),c.moveTo(u,p+a),g?c.lineTo(u,m+a):c.moveTo(u,m+a),b?c.lineTo(d,m+a):c.moveTo(d,m+a),x?c.lineTo(d,p+a):c.moveTo(d,p+a),v?c.lineTo(u,p+a):c.moveTo(u,p+a),c.stroke()))}function B(i,e,n,o){var a=i.fill;if(!a)return null;if(i.fillColor)return Z(i.fillColor,n,o,e);var r=t.color.parse(e);return r.a="number"==typeof a?a:.4,r.normalize(),r.toString()}k.setData=w,k.setupGrid=P,k.draw=N,k.getPlaceholder=function(){return i},k.getCanvas=function(){return l},k.getPlotOffset=function(){return p},k.width=function(){return x},k.height=function(){return b},k.offset=function(){var t=c.offset();return t.left+=p.left,t.top+=p.top,t},k.getData=function(){return a},k.getAxes=function(){var i={};return t.each(u.concat(d),(function(t,e){e&&(i[e.direction+(1!=e.n?e.n:"")+"axis"]=e)})),i},k.getXAxes=function(){return u},k.getYAxes=function(){return d},k.c2p=S,k.p2c=function(t){var i,e,n,o={};for(i=0;i<u.length;++i)if((e=u[i])&&e.used&&(null==t[n="x"+e.n]&&1==e.n&&(n="x"),null!=t[n])){o.left=e.p2c(t[n]);break}for(i=0;i<d.length;++i)if((e=d[i])&&e.used&&(null==t[n="y"+e.n]&&1==e.n&&(n="y"),null!=t[n])){o.top=e.p2c(t[n]);break}return o},k.getOptions=function(){return r},k.highlight=Q,k.unhighlight=U,k.triggerRedrawOverlay=q,k.pointOffset=function(t){return{left:parseInt(u[M(t,"x")-1].p2c(+t.x)+p.left,10),top:parseInt(d[M(t,"y")-1].p2c(+t.y)+p.top,10)}},k.shutdown=function(){G&&clearTimeout(G),c.unbind("mousemove",H),c.unbind("mouseleave",V),c.unbind("click",X),y(v.shutdown,[c])},k.resize=function(){I(),A(l),A(s)},k.hooks=v,function(){for(var i=0;i<o.length;++i){var e=o[i];e.init(k),e.options&&t.extend(!0,r,e.options)}}(),function(i){var e;for(t.extend(!0,r,i),null==r.xaxis.color&&(r.xaxis.color=r.grid.color),null==r.yaxis.color&&(r.yaxis.color=r.grid.color),null==r.xaxis.tickColor&&(r.xaxis.tickColor=r.grid.tickColor),null==r.yaxis.tickColor&&(r.yaxis.tickColor=r.grid.tickColor),null==r.grid.borderColor&&(r.grid.borderColor=r.grid.color),null==r.grid.tickColor&&(r.grid.tickColor=t.color.parse(r.grid.color).scale("a",.22).toString()),e=0;e<Math.max(1,r.xaxes.length);++e)r.xaxes[e]=t.extend(!0,{},r.xaxis,r.xaxes[e]);for(e=0;e<Math.max(1,r.yaxes.length);++e)r.yaxes[e]=t.extend(!0,{},r.yaxis,r.yaxes[e]);for(r.xaxis.noTicks&&null==r.xaxis.ticks&&(r.xaxis.ticks=r.xaxis.noTicks),r.yaxis.noTicks&&null==r.yaxis.ticks&&(r.yaxis.ticks=r.yaxis.noTicks),r.x2axis&&(r.xaxes[1]=t.extend(!0,{},r.xaxis,r.x2axis),r.xaxes[1].position="top"),r.y2axis&&(r.yaxes[1]=t.extend(!0,{},r.yaxis,r.y2axis),r.yaxes[1].position="right"),r.grid.coloredAreas&&(r.grid.markings=r.grid.coloredAreas),r.grid.coloredAreasColor&&(r.grid.markingsColor=r.grid.coloredAreasColor),r.lines&&t.extend(!0,r.series.lines,r.lines),r.points&&t.extend(!0,r.series.points,r.points),r.bars&&t.extend(!0,r.series.bars,r.bars),null!=r.shadowSize&&(r.series.shadowSize=r.shadowSize),null!=r.highlightColor&&(r.series.highlightColor=r.highlightColor),e=0;e<r.xaxes.length;++e)C(u,e+1).options=r.xaxes[e];for(e=0;e<r.yaxes.length;++e)C(d,e+1).options=r.yaxes[e];for(var n in v)r.hooks[n]&&r.hooks[n].length&&(v[n]=v[n].concat(r.hooks[n]));y(v.processOptions,[r])}(n),function(){var e,n=i.children("canvas.flot-base"),o=i.children("canvas.flot-overlay");0==n.length||0==o?(i.html(""),i.css({padding:0}),"static"==i.css("position")&&i.css("position","relative"),I(),l=z("flot-base"),s=z("flot-overlay"),e=!1):(l=n.get(0),s=o.get(0),e=!0),h=l.getContext("2d"),f=s.getContext("2d"),c=t(s),e&&(i.data("plot").shutdown(),k.resize(),f.clearRect(0,0,m,g),c.unbind(),i.children().not([l,s]).remove()),i.data("plot",k)}(),w(e),P(),N(),r.grid.hoverable&&(c.mousemove(H),c.bind("mouseleave",V)),r.grid.clickable&&c.click(X),y(v.bindEvents,[c]);var j=[],G=null;function H(t){r.grid.hoverable&&Y("plothover",t,(function(t){return 0!=t.hoverable}))}function V(t){r.grid.hoverable&&Y("plothover",t,(function(t){return!1}))}function X(t){Y("plotclick",t,(function(t){return 0!=t.clickable}))}function Y(t,e,n){var o=c.offset(),l=e.pageX-o.left-p.left,s=e.pageY-o.top-p.top,h=S({left:l,top:s});h.pageX=e.pageX,h.pageY=e.pageY;var f=function(t,i,e){var n,o,l,s=r.grid.mouseActiveRadius,c=s*s+1,h=null;for(n=a.length-1;n>=0;--n)if(e(a[n])){var f=a[n],u=f.xaxis,d=f.yaxis,p=f.datapoints.points,m=u.c2p(t),g=d.c2p(i),x=s/u.scale,b=s/d.scale;if(l=f.datapoints.pointsize,u.options.inverseTransform&&(x=Number.MAX_VALUE),d.options.inverseTransform&&(b=Number.MAX_VALUE),f.lines.show||f.points.show)for(o=0;o<p.length;o+=l){var v=p[o],k=p[o+1];if(null!=v&&!(v-m>x||v-m<-x||k-g>b||k-g<-b)){var y=Math.abs(u.p2c(v)-t),w=Math.abs(d.p2c(k)-i),M=y*y+w*w;M<c&&(c=M,h=[n,o/l])}}if(f.bars.show&&!h){var T="left"==f.bars.align?0:-f.bars.barWidth/2,S=T+f.bars.barWidth;for(o=0;o<p.length;o+=l){v=p[o],k=p[o+1];var C=p[o+2];null!=v&&(a[n].bars.horizontal?m<=Math.max(C,v)&&m>=Math.min(C,v)&&g>=k+T&&g<=k+S:m>=v+T&&m<=v+S&&g>=Math.min(C,k)&&g<=Math.max(C,k))&&(h=[n,o/l])}}}return h?(n=h[0],o=h[1],l=a[n].datapoints.pointsize,{datapoint:a[n].datapoints.points.slice(o*l,(o+1)*l),dataIndex:o,series:a[n],seriesIndex:n}):null}(l,s,n);if(f&&(f.pageX=parseInt(f.series.xaxis.p2c(f.datapoint[0])+o.left+p.left,10),f.pageY=parseInt(f.series.yaxis.p2c(f.datapoint[1])+o.top+p.top,10)),r.grid.autoHighlight){for(var u=0;u<j.length;++u){var d=j[u];d.auto!=t||f&&d.series==f.series&&d.point[0]==f.datapoint[0]&&d.point[1]==f.datapoint[1]||U(d.series,d.point)}f&&Q(f.series,f.datapoint,t)}i.trigger(t,[h,f])}function q(){var t=r.interaction.redrawOverlayInterval;-1!=t?G||(G=setTimeout(_,t)):_()}function _(){var t,i;for(G=null,f.save(),f.clearRect(0,0,m,g),f.translate(p.left,p.top),t=0;t<j.length;++t)(i=j[t]).series.bars.show?K(i.series,i.point):$(i.series,i.point);f.restore(),y(v.drawOverlay,[f])}function Q(t,i,e){if("number"==typeof t&&(t=a[t]),"number"==typeof i){var n=t.datapoints.pointsize;i=t.datapoints.points.slice(n*i,n*(i+1))}var o=J(t,i);-1==o?(j.push({series:t,point:i,auto:e}),q()):e||(j[o].auto=!1)}function U(t,i){null==t&&null==i&&(j=[],q()),"number"==typeof t&&(t=a[t]),"number"==typeof i&&(i=t.data[i]);var e=J(t,i);-1!=e&&(j.splice(e,1),q())}function J(t,i){for(var e=0;e<j.length;++e){var n=j[e];if(n.series==t&&n.point[0]==i[0]&&n.point[1]==i[1])return e}return-1}function $(i,e){var n=e[0],o=e[1],a=i.xaxis,r=i.yaxis,l="string"==typeof i.highlightColor?i.highlightColor:t.color.parse(i.color).scale("a",.5).toString();if(!(n<a.min||n>a.max||o<r.min||o>r.max)){var s=i.points.radius+i.points.lineWidth/2;f.lineWidth=s,f.strokeStyle=l;var c=1.5*s;n=a.p2c(n),o=r.p2c(o),f.beginPath(),"circle"==i.points.symbol?f.arc(n,o,c,0,2*Math.PI,!1):i.points.symbol(f,n,o,c,!1),f.closePath(),f.stroke()}}function K(i,e){var n="string"==typeof i.highlightColor?i.highlightColor:t.color.parse(i.color).scale("a",.5).toString(),o=n,a="left"==i.bars.align?0:-i.bars.barWidth/2;f.lineWidth=i.bars.lineWidth,f.strokeStyle=n,L(e[0],e[1],e[2]||0,a,a+i.bars.barWidth,0,(function(){return o}),i.xaxis,i.yaxis,f,i.bars.horizontal,i.bars.lineWidth)}function Z(i,e,n,o){if("string"==typeof i)return i;for(var a=h.createLinearGradient(0,n,0,e),r=0,l=i.colors.length;r<l;++r){var s=i.colors[r];if("string"!=typeof s){var c=t.color.parse(o);null!=s.brightness&&(c=c.scale("rgb",s.brightness)),null!=s.opacity&&(c.a*=s.opacity),s=c.toString()}a.addColorStop(r/(l-1),s)}return a}}t.plot=function(e,n,o){return new i(t(e),n,o,t.plot.plugins)},t.plot.version="0.8-alpha",t.plot.plugins=[],t.fn.plot=function(i,e){return this.each((function(){t.plot(this,i,e)}))}}(jQuery);