-
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
Composite charts don't handle rangeBandPadding #678
Comments
Thanks. Seems like there should be a more comprehensive way to do this, but instead there is https://github.com/dc-js/dc.js/blob/master/src/composite-chart.js#L245 and https://github.com/dc-js/dc.js/blob/master/src/composite-chart.js#L61 |
Probably generateG is the right place for this. |
It turns out this is actually a little bit more complicated than I thought, because the default gap on bar subcharts breaks rendering on composite charts:
Without that What do you think of that approach? |
I've been thinking about this more. Why does gap take precedence over barPadding for determining the width? What about changing it so that barPadding takes precedence, if it's been set, but gap has a default of 2 if barPadding hasn't been set? |
That sounds like it would preserve the current behavior, but in a simpler more direct way. If so, the change would be welcome. Please try it out and see if the current tests still pass. That won't quite guarantee that it's a non-breaking change, but it would give some assurance. |
Progress report: I have a branch that doesn't quite work at https://github.com/jcamins/dc.js/tree/issue678 . Two unit tests are still failing: There's still a logic bug somewhere in the default gap code. |
@jcamins, this code is really a mess, isn't it? There are two competing ways of determining the gaps. My understanding is that this is partly because we can't use rangeBands for charts with a quantitative scale, and some of the fiddly logic is due to trying to keep backward compatibility. However, your fix should clean it up a bit, and if you look at the failing tests above, they look like they're just an off-by-one bug - "expected 90 to be less than 90" etc. If you have time, would you like to to give it another try and submit a PR? |
If you create a composite chart with (for example) an ordinal bar chart, rangeBandPadding is not set for the sub charts, but still has an effect, so you have to set rangeBandPadding on all the subcharts using .barPadding, and also set the rangeBandPadding using ._rangeBandPadding on the composite chart.
I would be happy to fix this and submit a PR but I can't figure out where subcharts inherit settings from the parent. Any pointers?
The text was updated successfully, but these errors were encountered: