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

Pie Chart - Sector too small to render #57

Closed
Evildonald opened this issue Jul 20, 2010 · 1 comment
Closed

Pie Chart - Sector too small to render #57

Evildonald opened this issue Jul 20, 2010 · 1 comment

Comments

@Evildonald
Copy link

I'm creating little pie charts (only 35px radius) and when i have extreme values (eg [1000000, 10] ) the sector becomes too small to render and then the entire chart fails.

  • It renders incorrectly
  • doesn't create a label for the small item

I've tried poking around to see if it's possible to ensure a minimum render size, but I've not had much luck yet.

@Evildonald
Copy link
Author

Once again, I can see that this is intentional coding for some reason. Again, this goes against traditional graphing libraries where if you want to not include a value you don't include it in the data set, not have the graph automatically and silently drop values you intentionally included.

If anyone else finds this a problem (and it was a deal breaker for me), comment out the following lines and sectors won't be "cut"

    for (i = 0; i < len; i++) {
        if (defcut && values[i] * 360 / total <= 1.5) {
            cut = i;
            defcut = false;
        }
        if (i > cut) {
            defcut = false;
            values[cut].value += values[i];
            values[cut].others = true;
            others = values[cut].value;
        }
    }
    len = Math.min(cut + 1, values.length);

@karolk karolk closed this as completed Aug 16, 2012
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

No branches or pull requests

2 participants