apache / apache/echarts

[Bug] 饼图的半径radius设置为数值是半径,百分比是直径,与官方文档不一致

Open
#20,828 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.6.1

### Link to Minimal Reproduction

https://echarts.apache.org/zh/option.html#series-pie.radius

### Steps to Reproduce

1.html里定义box

.box {
height: 400px;
width: 500px;
display: inline-block;
background: rgba(140, 102, 102, 0.1);
border: 1px solid black;
}

2.pie.js里绘制饼图
series: [{
name: '所售商品',
type: 'pie',
radius: '40%',//设置饼图大小,直径设置百分比,对应值为160px
// radius: 80,//设置饼图半径大小,对应直径为160px
...

### Current Behavior

3.运行时发现,radius: '40%'和radius: 80效果是一样的。然而官方文档中说是:
[series-pie.](https://echarts.apache.org/zh/option.html#series-pie) [radius](https://echarts.apache.org/zh/option.html#series-pie.radius) = [0, '75%']
numberstringArray
饼图的半径。可以为如下类型:
number:直接指定外半径值。
string:例如,'20%',表示外半径为可视区尺寸(容器高宽中较小一项)的 20% 长度。

number和string都是外半径值,如果百分比也是半径值,则直径值*2=320px,和数值半径80得来的直径160px不一样,为甚画出来的图都是直接160px。

是官方文档没有讲清楚吗?百分比应该是指外直径值?

### Expected Behavior

数值和百分比代表的半径或直接,请详细说清楚

### Environment

```markdown
- OS:Win11
- Browser:chrome
- Framework:html
```

### Any additional comments?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.