Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing bug "pie char is not shown when only one option has votes" #144

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

flecox
Copy link

@flecox flecox commented Mar 15, 2012

the problem was.. when we have more than one option and all votes are in only one of them.
the scripts tries to draw an arc using paper.path.. starting at a position and ending at the same position,
because the positions are the same this doesn't draw anything.

so I've added a fix..

if the option 's value is equal to the total then draw a circle.

I've also minified the file

regards

@davidgoli
Copy link

+1

@blackwatertepes
Copy link

I've added a fix in issue #156, which removes the stroke from the sectors valued at 0

@ghost ghost assigned karolk Aug 16, 2012
var ipath = sector(cx, cy, 1, angle, angle - 360 * values[i] / total).join(",");
//if all votes are in only one option must draw a circle
if (values[i] / total === 1) {
var circle = paper.circle(cx, cy, r).attr({ fill: chartinst.colors[i], stroke: opts.stroke || "#fff", "stroke-width": opts.strokewidth == null ? 1 : opts.strokewidth });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be:
var circle = paper.circle(cx, cy, r).attr({ fill: opts.colors && opts.colors[i] || chartinst.colors[i], stroke: opts.stroke || "#fff", "stroke-width": opts.strokewidth == null ? 1 : opts.strokewidth });

Otherwise you're not getting the colors set up in options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants