You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/10/28 02:14:42 UTC
[GitHub] [echarts] ProgramPlayer opened a new issue, #17842: [Bug] 饼图百分比格式化错误
ProgramPlayer opened a new issue, #17842:
URL: https://github.com/apache/echarts/issues/17842
### Version
5.4.0
### Link to Minimal Reproduction
https://codepen.io/hank-ly/pen/RwJPRyB
### Steps to Reproduce
渲染饼图,值1设为382206,值2设为2,并设置显示label
### Current Behavior
在精度为2的情况下,我在对数值 382206和2 进行百分比显示时,所显示出的百分比为100%,但实际应为99.99%。
### Expected Behavior
382206/382208 后的百分比格式化应为99.99%。
### Environment
```markdown
- OS:window10
- Browser:chrome 106.0.5249.121
- Framework:
```
### Any additional comments?
经测试后发现,在执行 99.99947672471534.toFixed(2) 后会出现这种情况
--
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: commits-unsubscribe@echarts.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] Ovilia closed issue #17842: [Bug] 饼图百分比格式化错误
Posted by GitBox <gi...@apache.org>.
Ovilia closed issue #17842: [Bug] 饼图百分比格式化错误
URL: https://github.com/apache/echarts/issues/17842
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] Ovilia commented on issue #17842: [Bug] 饼图百分比格式化错误
Posted by GitBox <gi...@apache.org>.
Ovilia commented on issue #17842:
URL: https://github.com/apache/echarts/issues/17842#issuecomment-1296495547
I don't think this is a bug. `382206/382208` is `0.99999477`. When the precision is 2, it should be rounded to be 100% rather than 99.99%.
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] echarts-bot[bot] commented on issue #17842: [Bug] 饼图百分比格式化错误
Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #17842:
URL: https://github.com/apache/echarts/issues/17842#issuecomment-1294356588
@ProgramPlayer It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
<details><summary><b>TRANSLATED</b></summary><br>
**TITLE**
[BUG] Pie chart percentage formatting error
**BODY**
### Version
5.4.0
### Link to Minimal Reproduction
https://codepen.io/hank-ly/pen/RwJPRyB
### Steps to Reproduce
Render the pie chart with a value of 1 set to 382206, a value of 2 set to 2, and a display label
### Current Behavior
With an accuracy of 2, when I display percentages for the values 382206 and 2, the percentage displayed is 100%, but it should actually be 99.99%.
### Expected Behavior
The percentage format after 382206/382208 should be 99.99%.
### Environment
```markdown
- OS:window10
- Browser:chrome 106.0.5249.121
- Framework:
```
### Any additional comments?
Testing has found that this occurs after executing 99.99947672471534.toFixed(2).
</details>
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] ProgramPlayer commented on issue #17842: [Bug] 饼图百分比格式化错误
Posted by GitBox <gi...@apache.org>.
ProgramPlayer commented on issue #17842:
URL: https://github.com/apache/echarts/issues/17842#issuecomment-1311292567
> 默认情况下, `{d}` is the rounded result of percentage. If you don't think it appropriate for your case, you can use callback function to do the formatting.
好的,谢谢。
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] ProgramPlayer commented on issue #17842: [Bug] 饼图百分比格式化错误
Posted by GitBox <gi...@apache.org>.
ProgramPlayer commented on issue #17842:
URL: https://github.com/apache/echarts/issues/17842#issuecomment-1297940271
> I don't think this is a bug. `382206/382208` is `0.99999477`. When the precision is 2, it should be rounded to be 100% rather than 99.99%.
嗯嗯,你说的没错,算法确实没问题。那以后要是遇到保留2位小数的情况,大部分情况下{d}变量不就都用不了了哦,毕竟100%和99.99%所表达的含义还是有差别的。
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] Ovilia commented on issue #17842: [Bug] 饼图百分比格式化错误
Posted by GitBox <gi...@apache.org>.
Ovilia commented on issue #17842:
URL: https://github.com/apache/echarts/issues/17842#issuecomment-1301728701
By default, `{d}` is the rounded result of percentage. If you don't think it appropriate for your case, you can use callback function to do the formatting.
--
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: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org