Skip to content

Conversation

@luis-ca
Copy link

@luis-ca luis-ca commented Oct 16, 2012

Added a simple implementation of a pie chart. Feedback welcome.

@oesmith
Copy link
Contributor

oesmith commented Oct 21, 2012

This is some really good work! 👍

There's still a few challenges outstanding before it's ready for release though.

  • a minimum segment size, so that segments don't disappear when they become too small
  • automatic label scaling so large labels don't overlap the pie or overflow the container boundaries
  • smarter label positioning to stop the labels for small adjacent segments from overlapping

Labelling is a difficult problem for pie charts, especially that last problem of overlapping labels. I'd almost be tempted to take an approach similar to the donut chart of only showing the label for the currently selected segment. After all, a pie chart is just an aid to visualise some tabular data -- so if all of the data is important, you'd have the table alongside the pie chart on the same page...

Hope that helps!

Olly

@luis-ca
Copy link
Author

luis-ca commented Oct 21, 2012

Cool, thanks. Will try to address these soon.

@riccardoprandini01
Copy link

mmm very interesting, may I suggest to add an option show zero values: true/false

@oesmith
Copy link
Contributor

oesmith commented Dec 20, 2012

A side-comment regarding zero values:

The 'safe' behaviour for the donut chart is to show zero values as very thin slices so they can be hovered and a zero value can be shown to the end user.

If you're convinced that your charts shouldn't show zero values (I'm not), then I recommend you remove those values before passing them to the chart to render.

@kazzkiq
Copy link

kazzkiq commented Dec 27, 2012

I agree with @oesmith in his last post. I've faced issues with one application i've build once. The pie chart was about 99.99% one category and 0.01% another (I was using raphael.js back then). The result? The pie was all one slice and it was a fight to hover the super-tinny slice representing the minor category.

I think that for values that are lower than ... maybe 2% the size of the slice should stay equal. The user will understand that the slice have "negligible" value and can represent almost nothing, but at same time he will still be able to hover it without problems.

Just a tip. :)

@gamov
Copy link

gamov commented Jan 15, 2013

My 2 cents:
I believe labeling the pie chart is important, so you can 'get' the distribution without having to build a mental model ([this color = this category, color2 = category 2, etc]). My reports need to be printed for management so the labeling is crucial.
It is indeed difficult.

@oesmith oesmith mentioned this pull request Jan 25, 2013
@oesmith
Copy link
Contributor

oesmith commented Jan 25, 2013

Printing isn't a use case I've considered at all when building Morris.js. Does it work at all?

I'm closing this PR, since it's gone stale.

@oesmith oesmith closed this Jan 25, 2013
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.

5 participants