(function(v){function C(d,a,e,l){if(a.points.errorbars){d=[{x:!0,number:!0,required:!0},{y:!0,number:!0,required:!0}];e=a.points.errorbars;if("x"==e||"xy"==e)a.points.xerr.asymmetric&&d.push({x:!0,number:!0,required:!0}),d.push({x:!0,number:!0,required:!0});if("y"==e||"xy"==e)a.points.yerr.asymmetric&&d.push({y:!0,number:!0,required:!0}),d.push({y:!0,number:!0,required:!0});l.format=d}}function A(d,a,e,l,c,r,B,g,j,h,w){l+=h;c+=h;r+=h;"x"==a.err?(c>e+j?u(d,[[c,l],[Math.max(e+j,w[0]),l]]):B=!1,r<e-
j?u(d,[[Math.min(e-j,w[1]),l],[r,l]]):g=!1):(c<l-j?u(d,[[e,c],[e,Math.min(l-j,w[0])]]):B=!1,r>l+j?u(d,[[e,Math.max(l+j,w[1])],[e,r]]):g=!1);j=null!=a.radius?a.radius:j;B&&("-"==a.upperCap?"x"==a.err?u(d,[[c,l-j],[c,l+j]]):u(d,[[e-j,c],[e+j,c]]):v.isFunction(a.upperCap)&&("x"==a.err?a.upperCap(d,c,l,j):a.upperCap(d,e,c,j)));g&&("-"==a.lowerCap?"x"==a.err?u(d,[[r,l-j],[r,l+j]]):u(d,[[e-j,r],[e+j,r]]):v.isFunction(a.lowerCap)&&("x"==a.err?a.lowerCap(d,r,l,j):a.lowerCap(d,e,r,j)))}function u(d,a){d.beginPath();
d.moveTo(a[0][0],a[0][1]);for(var e=1;e<a.length;e++)d.lineTo(a[e][0],a[e][1]);d.stroke()}function D(d,a){var e=d.getPlotOffset();a.save();a.translate(e.left,e.top);v.each(d.getData(),function(d,c){if(c.points.errorbars&&(c.points.xerr.show||c.points.yerr.show)){var e=c.datapoints.points,u=c.datapoints.pointsize,g=[c.xaxis,c.yaxis],j=c.points.radius,h=[c.points.xerr,c.points.yerr],w=!1;if(g[0].p2c(g[0].max)<g[0].p2c(g[0].min)){var w=!0,s=h[0].lowerCap;h[0].lowerCap=h[0].upperCap;h[0].upperCap=s}var v=
!1;g[1].p2c(g[1].min)<g[1].p2c(g[1].max)&&(v=!0,s=h[1].lowerCap,h[1].lowerCap=h[1].upperCap,h[1].upperCap=s);for(var n=0;n<c.datapoints.points.length;n+=u){var x,b=c.datapoints.points,p=null,q=null,k=null,m=null;x=c.points.xerr;var f=c.points.yerr,t=c.points.errorbars;"x"==t||"xy"==t?x.asymmetric?(p=b[n+2],q=b[n+3],"xy"==t&&(f.asymmetric?(k=b[n+4],m=b[n+5]):k=b[n+4])):(p=b[n+2],"xy"==t&&(f.asymmetric?(k=b[n+3],m=b[n+4]):k=b[n+3])):"y"==t&&(f.asymmetric?(k=b[n+2],m=b[n+3]):k=b[n+2]);null==q&&(q=p);
null==m&&(m=k);b=[p,q,k,m];x.show||(b[0]=null,b[1]=null);f.show||(b[2]=null,b[3]=null);x=b;for(f=0;f<h.length;f++)if(b=[g[f].min,g[f].max],x[f*h.length]&&(p=e[n],q=e[n+1],k=[p,q][f]+x[f*h.length+1],m=[p,q][f]-x[f*h.length],!("x"==h[f].err&&(q>g[1].max||q<g[1].min||k<g[0].min||m>g[0].max))))if(!("y"==h[f].err&&(p>g[0].max||p<g[0].min||k<g[1].min||m>g[1].max))){var z=t=!0;k>b[1]&&(t=!1,k=b[1]);m<b[0]&&(z=!1,m=b[0]);if("x"==h[f].err&&w||"y"==h[f].err&&v)s=m,m=k,k=s,s=z,z=t,t=s,s=b[0],b[0]=b[1],b[1]=
s;p=g[0].p2c(p);q=g[1].p2c(q);k=g[f].p2c(k);m=g[f].p2c(m);b[0]=g[f].p2c(b[0]);b[1]=g[f].p2c(b[1]);var s=h[f].lineWidth?h[f].lineWidth:c.points.lineWidth,y=null!=c.points.shadowSize?c.points.shadowSize:c.shadowSize;0<s&&0<y&&(y/=2,a.lineWidth=y,a.strokeStyle="rgba(0,0,0,0.1)",A(a,h[f],p,q,k,m,t,z,j,y+y/2,b),a.strokeStyle="rgba(0,0,0,0.2)",A(a,h[f],p,q,k,m,t,z,j,y/2,b));a.strokeStyle=h[f].color?h[f].color:c.color;a.lineWidth=s;A(a,h[f],p,q,k,m,t,z,j,0,b)}}}});a.restore()}v.plot.plugins.push({init:function(d){d.hooks.processRawData.push(C);
d.hooks.draw.push(D)},options:{series:{points:{errorbars:null,xerr:{err:"x",show:null,asymmetric:null,upperCap:null,lowerCap:null,color:null,radius:null},yerr:{err:"y",show:null,asymmetric:null,upperCap:null,lowerCap:null,color:null,radius:null}}}},name:"errorbars",version:"1.0"})})(jQuery);
