Fix for donut chart when a series only has one non-zero value

If a data series had only one non-zero value that was not the first element, such as [0, 0, 23, 0, 0], it would incorrectly set the startAngle. This fix checks the series first then updates the startAngle calculation to take that into consideration.
Yes, no problem, I'll update it and re-submit. Thanks!

On Mon, Oct 6, 2014 at 1:41 PM, Gion Kunz <notifications@github.com> wrote:

> In source/scripts/chartist.pie.js:
>
> > @@ -166,6 +166,9 @@
> >          y: chartRect.y2 + chartRect.height() / 2
> >        };
> >
> > +      // Check if there is only one non-zero value in the series array.
> > +      var hasSingleValInSeries = data.series.filter(function(val) { return val !== 0; }).length === 1;
>
> Cool stuff :-) Thanks for working on this and using Array extras! In
> Chartist we follow the convention to write function bodies on a new line.
> Can you put the return statement on a new line something like this?
>
> var hasSingleValInSeries = data.series.filter(function(val) {
>   return val !== 0; }).length === 1;
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/gionkunz/chartist-js/pull/61/files#r18476227>.
>