!function(e){function t(t){function i(t,i,n){if(i.threshold){var s,o,r,a,l,u=n.pointsize,c=e.extend({},i);c.datapoints={points:[],pointsize:u},c.label=null,c.color=i.threshold.color,c.threshold=null,c.originSeries=i,c.data=[];var h=i.threshold.below,d=n.points,p=i.lines.show;for(threspoints=[],newpoints=[],s=0;s<d.length;s+=u){if(o=d[s],r=d[s+1],l=a,a=h>r?threspoints:newpoints,p&&l!=a&&null!=o&&s>0&&null!=d[s-u]){var f=(o-d[s-u])/(r-d[s-u+1])*(h-r)+o;for(l.push(f),l.push(h),m=2;u>m;++m)l.push(d[s+m]);for(a.push(null),a.push(null),m=2;u>m;++m)a.push(d[s+m]);for(a.push(f),a.push(h),m=2;u>m;++m)a.push(d[s+m])}a.push(o),a.push(r)}n.points=newpoints,c.datapoints.points=threspoints,c.datapoints.points.length>0&&t.getData().push(c)}}t.hooks.processDatapoints.push(i)}var i={series:{threshold:null}};e.plot.plugins.push({init:t,options:i,name:"threshold",version:"1.0"})}(jQuery);