!function(t){t.defaults.easypie=t.defaults.pie;var r=t.controllers.pie.extend({draw:function(r){var a=this,e=a.chart,o=e.chart.ctx,i=a.getDataset(),n=e.options,h=i.borderWidth,d=Math.min(e.width,e.height)-h,l=e.width/2,c=e.height/2,s=Math.min(Math.max(-1,i.data[0]/100||0),1),g=360*s*Math.PI/180,p=0+d/2*Math.cos(g),f=0+d/2*Math.sin(g),u=o.createLinearGradient(0,0,p,f);t.helpers.each(i.borderColor,function(t,r){u.addColorStop(r/(i.borderColor.length-1),t)}),o.save(),o.translate(l,c),o.rotate(((n.rotate||0)/180-.5)*Math.PI),this.drawCircle(o,d/2,i.backgroundColor,h,1),this.drawCircle(o,d/2,u,h,s*r),o.restore()},drawCircle:function(t,r,a,e,o){var i=(o=Math.min(Math.max(-1,o||0),1))<=0;t.beginPath(),t.lineCap="round",t.arc(0,0,r,0,2*Math.PI*o,i),t.strokeStyle=a,t.lineWidth=e,t.stroke()}});t.controllers.easypie=r;var a={beforeDatasetUpdate:function(r){if(r.options.gradient){var a=r.ctx,e=r.width,o=r.height,i=r.data.datasets,n=r.config.type;t.helpers.each(i,function(i){var h=i.gradient||i.borderColor,d=e,l=0;if("bar"!=n&&"horizontalBar"!=n||(h=i.gradient||i.backgroundColor),"v"==r.options.gradient&&(d=0,l=o),i.gradient=h,"string"!=typeof h){var c=a.createLinearGradient(0,0,d,l);t.helpers.each(h,function(t,r){c.addColorStop(r/(h.length-1),t)}),"bar"==n||"horizontalBar"==n?i.backgroundColor=c:i.borderColor=c}})}}};t.pluginService.register(a)}(Chart);