Raman-Katiyar opened a new pull request, #21823:
URL: https://github.com/apache/echarts/pull/21823

   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   ### What does this PR do?
   
   Fixes pie sector angles being proportioned over the full angle range with 
`padAngle` carved out of each sector afterwards, which shrank sectors down to 
`minAngle` even when their fair angle was larger than `minAngle`.
   
   ### Fixed issues
   
   - #20603: [Bug] pie.minAngle bug when sector is not exceeding minAngle
   
   ## Details
   
   ### Before
   
   In `pieLayout` (`src/chart/pie/pieLayout.ts`), the sector span was 
proportioned over the whole circle and `padAngle` was then carved out of each 
sector, with `minAngle` clamped in that span space. With values 2 and 10, 
`padAngle: 15` and `minAngle: 45`, reserving the two 15° pads leaves 330°, so 
the sectors should be 55° and 275° — but the small sector came out at exactly 
45° (`minAngle`) and the large one at 285°, breaking the value-to-angle ratio. 
The redistribution pass also did not raise a sector again if redistributing 
pushed it below `minAngle`, and the stored item-layout angle could be left 
stale after redistribution.
   
   ### After
   
   `padAngle` is now reserved first (`availableAngle = angleRange − padAngle × 
validDataCount`) and the remaining angle is distributed over the sectors in 
proportion to their values (evenly for roseType 'area' and for a zero sum shown 
via `stillShowZeroSum`), so `minAngle` applies to the sector angles themselves. 
Sectors below `minAngle` are raised to `minAngle` and the remaining angle is 
redistributed over the others, repeated until stable, because redistributing 
can push another sector below `minAngle` again; when `minAngle` cannot be 
satisfied for every sector, the angle falls back to an even distribution, as 
before. The issue's configuration now yields 55° and 275°.
   
   Validation results:
   
   - New 8-case regression test in `test/ut/spec/series/pie.test.ts`: 5 cases 
fail without the fix, all 8 pass with it.
   - Full unit suite: 27 suites / 202 tests pass.
   - `npm run checktype`, ESLint on the changed files, and `npm run build` all 
pass. Regenerated `dist/` output is not included in this PR.
   
   ## Document Info
   
   One of the following should be checked.
   
   - [x] This PR doesn't relate to document changes
   - [ ] The document should be updated later
   - [ ] The document changes have been made in apache/echarts-doc#xxx
   
   ## Misc
   
   ### Security
   
   - [ ] This PR ensures the security (I have read the security policy)
   
   ### ZRender Changes
   
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   New regression test: `test/ut/spec/series/pie.test.ts`, covering the #20603 
configuration plus `minAngle`/`padAngle` redistribution cases.
   
   ### Others
   
   - [x] Please squash the commits into one when merging
   
   This PR is a single commit.
   
   Could a maintainer please approve the CI workflow run for this PR? Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to