-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Description
Version
5.5.1
Link to Minimal Reproduction
Steps to Reproduce
In the above demo, we have two pie sectors with value 2
and 10
. With padAngle: 15
, We first reserve 15 * 2 from 360 degrees for padding, and leaving with 360 - 15 * 2 = 330. For data 2
and 10
, they should each have the angle of 330 / (2 + 10) * 2 = 55
and 330 / (2 + 10) * 10 = 275
degrees.
I use graphic.elements
to draw two triangles with 55 and 275 degrees and it's clear that the pie pieces have wrong angles.
Current Behavior
The green pie piece is 45 degrees, which is the same as minAngle
. But 55 degrees are larger than 45, and there is no other reason for it to be smaller.
Expected Behavior
Expected the green pie piece to be 55 degrees as the green triangle shows.
Environment
- OS:
- Browser:
- Framework:
Any additional comments?
This bug is cause by current implementation simplified as: angle = Math.max(angle, padAngle + minAngle) - padAngle
. Which is not mathematically correct.
For example, in the deme's case, the piece has 55 degrees and all constrains meets (1. no piece should have an angle smaller than 45; 2. there are paddings each of 15 degrees) with it being 55 degrees and the other 275 degree and two paddings each being 15 degrees. But in fact, we are having the pieces with 45 degrees and 285 degrees with no obvious reason and breaking the ratio of data values to the angles of pie pieces.
This may be a subtle bug since the padAngle
and minAngle
is usually quite small. But it's always nice to make it work well in all cases.