!function(r){r.color={},r.color.make=function(t,e,i,o){var n={};return n.r=t||0,n.g=e||0,n.b=i||0,n.a=null!=o?o:1,n.add=function(t,e){for(var i=0;it.datamax&&i!=m&&(t.datamax=i)}for(G.each(W(),function(t,e){e.datamin=d,e.datamax=p,e.used=!1}),t=0;te.max||("x"==e.direction?(r="center",o=b.left+e.p2c(i.v),"bottom"==e.position?n=l.top+l.padding:(n=l.top+l.height-l.padding,a="bottom")):(a="middle",n=b.top+e.p2c(i.v),"left"==e.position?(o=l.left+l.width-l.padding,r="right"):o=l.left+l.padding),u.addText(c,o,n,i.label,h,null,null,r,a))}}),function(){if(d.find(".legend").remove(),!T.legend.show)return;for(var t,e,i=[],o=[],n=!1,r=T.legend.labelFormatter,a=0;a"),i.push(""),n=!0),i.push('
'+s.label+"")}n&&i.push("");if(0==i.length)return;var c=''+i.join("")+"
";{var h,f,u;null!=T.legend.container?G(T.legend.container).html(c):(h="",f=T.legend.position,null==(u=T.legend.margin)[0]&&(u=[u,u]),"n"==f.charAt(0)?h+="top:"+(u[1]+b.top)+"px;":"s"==f.charAt(0)&&(h+="bottom:"+(u[1]+b.bottom)+"px;"),"e"==f.charAt(1)?h+="right:"+(u[0]+b.right)+"px;":"w"==f.charAt(1)&&(h+="left:"+(u[0]+b.left)+"px;"),f=G('
'+c.replace('style="','style="position:absolute;'+h+";")+"
").appendTo(d),0!=T.legend.backgroundOpacity&&(null==(u=T.legend.backgroundColor)&&((u=(u=T.grid.backgroundColor)&&"string"==typeof u?G.color.parse(u):G.color.extract(f,"background-color")).a=1,u=u.toString()),c=f.children(),G('
').prependTo(f).css("opacity",T.legend.backgroundOpacity)))}}()}function a(){u.clear(),S(C.drawBackground,[g]);var t=T.grid;t.show&&t.backgroundColor&&(g.save(),g.translate(b.left,b.top),g.fillStyle=H(T.grid.backgroundColor,k,0,"rgba(255, 255, 255, 0)"),g.fillRect(0,0,v,k),g.restore()),t.show&&!t.aboveData&&s();for(var e=0;en.max){if(d>n.max)continue;h=(n.max-f)/(d-f)*(u-h)+h,f=n.max}else if(f<=d&&d>n.max){if(f>n.max)continue;u=(n.max-f)/(d-f)*(u-h)+h,d=n.max}if(h<=u&&ho.max){if(u>o.max)continue;f=(o.max-h)/(u-h)*(d-f)+f,h=o.max}else if(h<=u&&u>o.max){if(h>o.max)continue;d=(o.max-h)/(u-h)*(d-f)+f,u=o.max}h==l&&f==s||g.moveTo(o.p2c(h)+e,n.p2c(f)+i),l=u,s=d,g.lineTo(o.p2c(u)+e,n.p2c(d)+i)}}g.stroke()}g.save(),g.translate(b.left,b.top),g.lineJoin="round";var i=t.lines.lineWidth,o=t.shadowSize;{var n;0o.length+n);){var f,u,d=o[(a+=n)-n],p=o[a-n+s],m=o[a],x=o[a+s];if(l){if(0e.max){if(m>e.max)continue;p=(e.max-d)/(m-d)*(x-p)+p,d=e.max}else if(d<=m&&m>e.max){if(d>e.max)continue;x=(e.max-d)/(m-d)*(x-p)+p,m=e.max}l||(g.beginPath(),g.moveTo(e.p2c(d),i.p2c(r)),l=!0),p>=i.max&&x>=i.max?(g.lineTo(e.p2c(d),i.p2c(i.max)),g.lineTo(e.p2c(m),i.p2c(i.max))):p<=i.min&&x<=i.min?(g.lineTo(e.p2c(d),i.p2c(i.min)),g.lineTo(e.p2c(m),i.p2c(i.min))):(f=d,u=m,p<=x&&p=i.min?(d=(i.min-p)/(x-p)*(m-d)+d,p=i.min):x<=p&&x=i.min&&(m=(i.min-p)/(x-p)*(m-d)+d,x=i.min),x<=p&&p>i.max&&x<=i.max?(d=(i.max-p)/(x-p)*(m-d)+d,p=i.max):p<=x&&x>i.max&&p<=i.max&&(m=(i.max-p)/(x-p)*(m-d)+d,x=i.max),d!=f&&g.lineTo(e.p2c(f),i.p2c(p)),g.lineTo(e.p2c(d),i.p2c(p)),g.lineTo(e.p2c(m),i.p2c(x)),m!=u&&(g.lineTo(e.p2c(m),i.p2c(x)),g.lineTo(e.p2c(u),i.p2c(x))))}}}(t.datapoints,t.xaxis,t.yaxis));0r.max||ua.max||(g.beginPath(),f=r.p2c(f),u=a.p2c(u)+o,"circle"==l?g.arc(f,u,e,0,n?Math.PI:2*Math.PI,!1):l(g,f,u,e,n),g.closePath(),i&&(g.fillStyle=i,g.fill()),g.stroke())}}g.save(),g.translate(b.left,b.top);var i=t.points.lineWidth,o=t.shadowSize,n=t.points.radius,r=t.points.symbol;0==i&&(i=1e-4);{0a.axis.max||l.tol.axis.max||(a.from=Math.max(a.from,a.axis.min),a.to=Math.min(a.to,a.axis.max),l.from=Math.max(l.from,l.axis.min),l.to=Math.min(l.to,l.axis.max),a.from==a.to&&l.from==l.to||(a.from=a.axis.p2c(a.from),a.to=a.axis.p2c(a.to),l.from=l.axis.p2c(l.from),l.to=l.axis.p2c(l.to),a.from==a.to||l.from==l.to?(g.beginPath(),g.strokeStyle=r.color||T.grid.markingsColor,g.lineWidth=r.lineWidth||T.grid.markingsLineWidth,g.moveTo(a.from,l.from),g.lineTo(a.to,l.to),g.stroke()):(g.fillStyle=r.color||T.grid.markingsColor,g.fillRect(a.from,l.to,a.to-a.from,l.from-l.to))))}e=W(),i=T.grid.borderWidth;for(var s=0;su.max||"full"==p&&("object"==typeof i&&0l.max||ms.max||(ul.max&&(d=l.max,g=!1),ps.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()),0=Math.min(w,g)&&b+v<=u&&u<=b+k:g+v<=f&&f<=g+k&&u>=Math.min(w,b)&&u<=Math.max(w,b))&&(r=[a,y/m])}}return r?(a=r[0],y=r[1],m=M[a].datapoints.pointsize,{datapoint:M[a].datapoints.points.slice(y*m,(y+1)*m),dataIndex:y,series:M[a],seriesIndex:a}):null}(n,r,i);if(l&&(l.pageX=parseInt(l.series.xaxis.p2c(l.datapoint[0])+o.left+b.left,10),l.pageY=parseInt(l.series.yaxis.p2c(l.datapoint[1])+o.top+b.top,10)),T.grid.autoHighlight){for(var s=0;sn.max||or.max)return;e=t.points.radius+t.points.lineWidth/2;l.lineWidth=e,l.strokeStyle=a;e*=1.5;i=n.p2c(i),o=r.p2c(o),l.beginPath(),"circle"==t.points.symbol?l.arc(i,o,e,0,2*Math.PI,!1):t.points.symbol(l,i,o,e,!1);l.closePath(),l.stroke()})(e.series,e.point);l.restore(),S(C.drawOverlay,[l])}function R(t,e,i){"number"==typeof t&&(t=M[t]),"number"==typeof e&&(o=t.datapoints.pointsize,e=t.datapoints.points.slice(o*e,o*(e+1)));var o=B(t,e);-1==o?(A.push({series:t,point:e,auto:i}),O()):i||(A[o].auto=!1)}function j(t,e){if(null==t&&null==e)return A=[],void O();var i;"number"==typeof t&&(t=M[t]),"number"==typeof e&&(i=t.datapoints.pointsize,e=t.datapoints.points.slice(i*e,i*(e+1)));e=B(t,e);-1!=e&&(A.splice(e,1),O())}function B(t,e){for(var i=0;i").css({position:"absolute",top:0,left:0,bottom:0,right:0,"font-size":"smaller",color:"#545454"}).insertAfter(this.element)),e=this.text[t]=G("
").addClass(t).css({position:"absolute",top:0,left:0,bottom:0,right:0}).appendTo(this.textContainer)),e},_.prototype.getTextInfo=function(t,e,i,o,n){var r,a,l;return e=""+e,r="object"==typeof i?i.style+" "+i.variant+" "+i.weight+" "+i.size+"px/"+i.lineHeight+"px "+i.family:i,null==(l=this._textCache[t])&&(l=this._textCache[t]={}),null==(a=l[r])&&(a=l[r]={}),null==(l=a[e])&&(t=G("
").html(e).css({position:"absolute","max-width":n,top:-9999}).appendTo(this.getTextLayer(t)),"object"==typeof i?t.css({font:r,color:i.color}):"string"==typeof i&&t.addClass(i),l=a[e]={width:t.outerWidth(!0),height:t.outerHeight(!0),element:t,positions:[]},t.detach()),l},_.prototype.addText=function(t,e,i,o,n,r,a,l,s){var a=this.getTextInfo(t,o,n,r,a),c=a.positions;"center"==l?e-=a.width/2:"right"==l&&(e-=a.width),"middle"==s?i-=a.height/2:"bottom"==s&&(i-=a.height);for(var h,f=0;h=c[f];f++)if(h.x==e&&h.y==i)return void(h.active=!0);h={active:!0,rendered:!1,element:c.length?a.element.clone():a.element,x:e,y:i},c.push(h),h.element.css({top:Math.round(i),left:Math.round(e),"text-align":l})},_.prototype.removeText=function(t,e,i,o,n,r){if(null==o){var a=this._textCache[t];if(null!=a)for(var l in a)if(d.call(a,l)){var s,c=a[l];for(s in c)if(d.call(c,s))for(var h=c[s].positions,f=0;u=h[f];f++)u.active=!1}}else for(var u,h=this.getTextInfo(t,o,n,r).positions,f=0;u=h[f];f++)u.x==e&&u.y==i&&(u.active=!1)},G.plot=function(t,e,i){return new o(G(t),e,i,G.plot.plugins)},G.plot.version="0.8.1",G.plot.plugins=[],G.fn.plot=function(t,e){return this.each(function(){G.plot(this,t,e)})}}(jQuery);