padAngle allows data that includes 0 angle to fill
dvnrsn opened this issue · 3 comments
https://codepen.io/devcon/pen/qMERrW
If there is data that includes a 0, the last padAngle is filled with a sliver. Is this expected behavior?
What is the expected behavior?
Here's what I notice with your example:
data = [1, 1, 2, 3, 5, 8, 13];
data = [0, 1, 1, 2, 3, 5, 8, 13];
data = [0, 0, 1, 1, 2, 3, 5, 8, 13];
The thing that doesn't make sense to me is that if there are multiple zeroes, there's still only one sliver.
Possible options to solve this:
- Do not produce any slivers (filter out zero values within the layout)
- Introduce multiple slivers for multiple zeroes
- Just leave it as-is and expect developers to filter out zeroes before using the layout
Which one would be preferable?
Do not produce any slivers I'd say
The problem here is that you’re using arc.padAngle, but as the documentation suggests, you should be using pie.padAngle instead. This gives you multiple slivers for multiple zeroes:
This can’t be fixed at the arc.padAngle level because there that padding is subtracted from the arc, and if the arc is zero-angle, there’s nothing to subtract from.