-
Notifications
You must be signed in to change notification settings - Fork 185
Implicitly stack bars #348
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
Conversation
I’d love help getting the unit tests working again… |
a1ab72e
to
6aea825
Compare
I get the impression that this should also apply to the area mark. |
Overlapping areas are more common than overlapping bars, but yes it would be consistent if bars and areas worked similarly. |
Added areas. I don’t know how to address your other comment. |
f6ca3db
to
3aa9c56
Compare
Oops, need to stack rect too. Works well though! It’s fun that you can turn on or off stacking by switching between y and y2. |
A foolproof solution for stacked areas should include the seriesX transform (and similarly seriesY transform for areaX). So I suppose 7594f0e#diff-8f62f80a02a317ce3253c0795d19093acea8456b90e720732b62455ef9d96203R94 might become something like maybeStackYSeriesX(…) I thought it would be a plugin, but I can research it now as a PR to this PR or to main. The risk with seriesX is that it might create a combinatory explosion if you make a mistake in your choice of x, transforming n data points into n^2. |
Do you think this is a blocker? It doesn’t feel like one for me. |
No, not a blocker; it's just a case where the default doesn't work out of the box; let's say that, if the series are incomplete on x and you want to represent them with a stacked areaY, you need the plugin; in the meantime we recommend using stacked rects (or bars, or rules). |
Yep. I feel like the seriesX transform should probably instead be an option to the stack transform that fills any missing values across stacks with zero. |
If a barY is specified without y1 or y2, implicitly apply the stackY transform. Same with barX, x1, and x2.
This is stacked:
This overlaps:
The idea is that this reduces the possibility of unintentionally overlapping opaque bars, but you can still opt-out of stacking easily if that’s what you intend.