-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix ordering option for the barChart. #766
Conversation
Thanks! Please try the tests with Also, a test or two for this feature would be appreciated. |
Now the "grunt test" should work. |
0165f54
to
8b14d1f
Compare
Some tests have been added to check ordering on barChart. |
…he reliability of the feature.
Thanks @mhodorogea! I think this should fix #772 |
groups[0].values = _chart._computeOrderedGroups(groups[0].values); | ||
} | ||
|
||
return groups.reduce(function (all, layer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not quite right because it only sorts the first stack. If there are multiple stacks, the latter stacks will get tacked on unsorted, and ruin the order. Probably we need to flatten first, then sort.
Sigh, it turns out this was still not quite correct, because ordinarily the ordering function takes a regular group I am reverting |
running _computeOrderedGroups on the d3.stack data meant that the ordering function had to have a different signature from usual, peering into the inner `.data`. this was causing a crossfilter crash in IE (#909). so revert that and instead have `_ordinalXDomain` pluck the data and order that. slightly more efficient for the other uses of `flattenStacks` that don't need ordering, and actually correct.
Fix the bug: ordering not working on barChart.
If you write in the barChart definition:
It will order the barChart xAxis by value increasing.
It will order the barChart xAxis by value decreasing.
It will order the barChart xAxis by key, alphabetical order.