-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Group bars, but don't stack them #3849
Comments
This is likely caused by #3563 |
@etimberg - you're right. Specifically, the removal of this line Chart.js/src/controllers/controller.bar.js Line 156 in 5387c48
Chart.js/src/controllers/controller.bar.js Lines 182 to 184 in 5387c48
I had removed it assuming it was a bug because this use case was not immediately obvious and also since the reverse (vertical stacking without stacking x) didn't seem valid. That said, is this a common use case? In the absence of a 3rd dimension, it causes a few problems (the smaller bar being hidden if it's behind the larger one, bar level tooltips not working, being mistaken for a stacked chart). On a related note, the last chart at http://peltiertech.com/overlapped-bar-chart-longer-bars-in-back/ does something similar but without the associate problems by controlling the individual bar widths. ilgiz-badamshin's chart works around the 1st and 3rd problems by using transparency (the 3rd color that is not in the legend, indicates the areas of overlap) |
Hmmm, I think that both of those cases (stacking X but not Y and vice versa) have been used. I do know that the stacked Y only does make something that sort of looks like a waterfall chart. I agree that it causes problems. The overlapped bar chart is almost a new chart type because it would need to sort the draw order to put largest bar at the back. |
Ah ok! I'll add that back then. I recall there was some thread where the waterfall was going to be implemented as a plug in, but now that you mention it, doing it here is better. I'll add back the lines I removed so that we have this functionality (waterfall) back. I don't see any code in the original to put the largest bar in the back - if it's easy enough I'll add it, otherwise (and I'm guessing its otherwise - because I don't see a nice place to sort elements in the bar controller) we'll probably need a separate issue for these layered bars (to push the taller ones to the back). |
Awesome 😄 Thanks so much for looking at this. I know you've done a couple of great features now (horizontal bars, group stacked bars) would you be interested in helping maintain? I don't think it's easy to sort the bars because that would involve changing how datasets draw (right now the datasets draw in order) so it's definitely a separate issue. |
PR submitted (just added the lines back and add a new test). @ilgiz-badamshin - sorry about that! @etimberg - there's a couple of plugins I'm working on right now - I'll probably have a bit more time after I'm done with those. I just pick up Issues and sort them out / fix them, yes? |
Yup, that's the idea :) |
Pr in #3899 |
Great, grouping bars without stacking is an excellent feature. Looking forward to the fix. Cheers guys. |
Fixed in #3899 |
It's possible to group bars, but don't stack them?
This work with
xAxes.stacked = true
andyAxes.stacked = false
in version 2.4.0: https://jsfiddle.net/tcc6bLdn/But in master another behavior : https://jsfiddle.net/5xo8rp9f/1/
The text was updated successfully, but these errors were encountered: