Skip to content
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

[Bug] pie.minAngle bug when sector is not exceeding minAngle #20603

Open
Ovilia opened this issue Dec 19, 2024 · 0 comments
Open

[Bug] pie.minAngle bug when sector is not exceeding minAngle #20603

Ovilia opened this issue Dec 19, 2024 · 0 comments
Labels
bug en This issue is in English topic: pie
Milestone

Comments

@Ovilia
Copy link
Contributor

Ovilia commented Dec 19, 2024

Version

5.5.1

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html?c=sunburst-simple&code=MYewdgzgLgBA7gSwCZQBYwLwwLYE8DCqAhgE5QB0A5gKZQDqyaAFAJQDcAUKJLKtQpVSwseQqQo0oACX6CorTt2gwSmGEwCyRNOWwIwTRClQAaGHwFCWMAFQwADOQAc1gPQwATJy7hlwAB5qRmgw7l4-PDDAuGoWcqGenAA2tDDQ4gCCYJQpalo6AAoAkrYwAIzkHmXJqdRgSFk51GrpZI25ANTqAKzdCWVO9tZ2-ajkxYq-sAAOIPpQEADiJNR1agDaHDAw6wFm0QC6Jls7qiPaY6AQTK1Q7dTWXXsqpaPkEPo3UJnZKY9RuCOJ3WZxgbyuTDqDV-DxgT38ZlBbw-Bih93-h2O212CIBBw4B28t3uagAtG9iqVHAAWboANk4aJhLW-bWZXSYHgA7H13AMhq8LuMipNIrN5hAAEJJACuzSwm2xz0xwKRQohxJhGNxap0KK-PyaGMBWNOgp0EKZRrhUR15rG-qtfxtKqVuMOBO8IGmUAQ4DUAG8ThBqCQENQIAAuGBB7bbKC4abUaMAcmm4ZTpu2SG0RGjirj21jhbjYCI2GTMBTREzJxLMAAbkRZZWyvY63GAL5ZuPF-tliupgBGtfr2ybLejHg7207HaBhZIRCQCBlUZ29kRC7jSSIQ-oSWjfbjJBA3yglc3M5gADMQCRsNoLyRUwGh52j8BO6OS3ewFAAGUEAAL0rDxqQ7bsOz0MB7mjWke2mZc4PKboTig7ZKCXaZUAQYAjw7A9qArf91wLQtj0LBMk1TWYklwJJ9GoH96wgYgaJja9C3FUjox4hZllWMAuJgDCx2gBjK0oktoFPABrSsUywoSWLHRiwGoBhjCnESxPrYDozbdt6z03sROoxS6IYpjVMLNiiA46TuLmXiYH4qUW10ns7ITFICLHONZJABThxbWyS3UzTGFQHSAtMwsDPKexjJLOdC3xWcOE7NggA

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug en This issue is in English topic: pie
Projects
None yet
Development

No branches or pull requests

1 participant