-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Automatically sort (and re-sort) stacked bar chart? #1711
Comments
Sorting the data points must be done by whatever builds the data object, nvd3 is just going to display the data in the same order it appears in the array of series data. |
I should note that while this isn't a defect, feel free to implement a solution and send us a pull request and we'll check it out :) |
One problem with that approach, as identified in the original post, is that the items will not re-sort when a user interacts with the filter. This may genuinely need to be handled by the chart, unless we are expected to write hooks that re-sort the data and send it back when the chart is filtered. What would be a proposed solution? |
Sorting bar charts is a relatively common need, and would save developer time if the library were to support it. E.g. the proposed solutions to this task seem to differ, and force the developer to write procedural code. A high level goal of a charting library is to allow charts to be designed declaratively. |
Please re-open this issue, as a feature request. The idea merits discussion, and a community-oriented project should give community ideas time to season. |
It's a feature request, but realistically a feature request is going to be dependent on someone picking it up and sending us a pull request, I'm trying to only keep feature requests open that I intend to do myself if I have time (which isn't often). If you really want this then send us a pull request with the changes :) |
In order for this to be a community project, we need to communicate and prioritize tasks collectively. That moves us out of the 'lone developer' mindset, where ideas can linger and be taken up in due time.
How about tagging this in some way, so that you can filter it out when deciding how to prioritize your time while allowing the community to 'remember' and discuss the feature? |
Oh okay, I'll open it and mark it as feature request if you really insist that much... but if you want this done you'll in all likelihood have to do it yourself. |
Thanks @liquidpele 😄 |
+1 |
1 similar comment
+1 |
We have a multi-bar chart that is rendering data in the order it is passed in. How do we sort a multi-bar chart in ascending or descending order?
Observation
In the screenshots above, the bars are sorted based on the array order, and retain the sorting order when filtering.
Desired result
It would be desirable for the bars to be sorted by the sum of their values, so that the largest or smallest bars are at opposite ends of the graph. This makes it easy for people to read the charts.
References
This has been requested previously on Stack Overflow and Github. The suggested solutions seem non-trivial and would probably be better handled by the charting library.
The text was updated successfully, but these errors were encountered: