(function(f){function e(e){e.hooks.drawSeries.push(s);e.hooks.shutdown.push(l);if(e.hooks.processOffset){e.hooks.processOffset.push(a)}}function a(e,a){var s=e.getData();for(var l=0;l<s.length;l++){if(!s[l].canvasRender&&s[l].showLabels&&!s[l].labelClass){s[l].labelClass="seriesLabel"+(l+1)}}}function s(o,n,r){if(!r.showLabels||!(r.labelClass||r.canvasRender)||!r.labels||r.labels.length==0){return}n.save();if(r.canvasRender){n.fillStyle=r.cColor;n.font=r.cFont}for(i=0;i<r.data.length;i++){if(r.labels[i]){var e=o.pointOffset({x:r.data[i][0],y:r.data[i][1]});var a=o.getPlotOffset();if(e.left>0&&e.left<o.width()&&e.top>0&&e.top<o.height())s(r.labels[i],e.left,e.top)}}n.restore();function s(e,a,s){var l=r.points.radius;if(!r.canvasRender){var t=f('<div class="'+r.labelClass+'">'+e+"</div>").css({position:"absolute"}).appendTo(o.getPlaceholder());switch(r.labelPlacement){case"above":t.css({top:s-(t.height()+l),left:a-t.width()/2});break;case"left":t.css({top:s-t.height()/2,left:a-(t.width()+l)});break;case"right":t.css({top:s-t.height()/2,left:a+l});break;default:t.css({top:s+l,left:a-t.width()/2})}}else{var i=n.measureText(e).width;switch(r.labelPlacement){case"above":a=a-i/2;s-=r.cPadding+l;n.textBaseline="bottom";break;case"left":a-=i+r.cPadding+l;n.textBaseline="middle";break;case"right":a+=r.cPadding+l;n.textBaseline="middle";break;default:n.textBaseline="top";s+=r.cPadding+l;a=a-i/2}n.fillText(e,a,s)}}}function l(e,a){var s=e.getData();for(var l=0;l<s.length;l++){if(!s[l].canvasRender&&s[l].labelClass){f("."+s[l].labelClass).remove()}}}var t={series:{showLabels:false,labels:[],labelClass:null,labelPlacement:"below",canvasRender:false,cColor:"#000",cFont:"9px, san-serif",cPadding:4}};f.plot.plugins.push({init:e,options:t,name:"seriesLabels",version:"0.2"})})(jQuery);