NickQiZhu/dc.js — pull request #242 by gordonwoodhull (2013-08-14 13:02:41+00:00)
Title: Fix pie chart wedge ordering - and perhaps others

There are a couple of problems with pie chart wedge ordering in dc.js 1.5:

1. crossfilter's heap functions pass in the value, not the key-value pair. So when baseChart's orderedGroup attempts to pass order() its own function, all the function returns is undefined because there is no key member.
2. crossfilter's heap sorts in descending order, so this default isn't very helpful anyway

I propose to add an ordering parameter to baseChart, which still defaults to key ordering, and to do a quicksort on group().all() when appropriate. Because limitation 1 above, there doesn't seem to be a way to use crossfilter (without adding another method to it).

This patch is for the pie chart but perhaps it applies to bar charts with an ordinal x axis, and row charts as well. I would be willing to generalize it in that direction (something like sortedAll in baseChart) if there is interest.

Another purpose for making this customizable is custom [factors](http://www.stats.gla.ac.uk/steps/glossary/anova.html#factor) which are typically string values with custom "levels".