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 Incorrect percentage display #17745

Closed
chiyu1996 opened this issue Oct 10, 2022 · 1 comment · Fixed by #17734
Closed

[Bug] Pie Incorrect percentage display #17745

chiyu1996 opened this issue Oct 10, 2022 · 1 comment · Fixed by #17734
Labels
bug en This issue is in English resolved topic: pie

Comments

@chiyu1996
Copy link

Version

5.4.0

Link to Minimal Reproduction

https://codepen.io/chiyu1996/pen/RwyqoEy

Steps to Reproduce

var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
var option;

option = {
tooltip: {
trigger: 'item',
formatter: '{a}
{b}: {c} ({d}%)'
},
legend: {
data: [
'Direct',
'Marketing',
'Search Engine',
'Email',
'Union Ads',
'Video Ads',
'Baidu',
'Google',
'Bing',
'Others'
]
},
series: [
{
name: 'Access From',
type: 'pie',
selectedMode: 'single',
radius: [0, '30%'],
label: {
position: 'inner',
fontSize: 14
},
labelLine: {
show: false
},
data: [
{ value: 1548, name: 'Search Engine' },
{ value: 775, name: 'Direct' },
{ value: 679, name: 'Marketing', selected: true }
]
},
{
name: 'Access From',
type: 'pie',
radius: ['45%', '60%'],
labelLine: {
length: 30
},
label: {
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}:}{c} {per|{d}%} ',
backgroundColor: '#F6F8FC',
borderColor: '#8C8D8E',
borderWidth: 1,
borderRadius: 4,
rich: {
a: {
color: '#6E7079',
lineHeight: 22,
align: 'center'
},
hr: {
borderColor: '#8C8D8E',
width: '100%',
borderWidth: 1,
height: 0
},
b: {
color: '#4C5058',
fontSize: 14,
fontWeight: 'bold',
lineHeight: 33
},
per: {
color: '#fff',
backgroundColor: '#4C5058',
padding: [3, 4],
borderRadius: 4
}
}
},
data: [
{ value: 0, name: 'Baidu' },
{ value: 0, name: 'Direct' },
{ value: 0, name: 'Email' },
{ value: 0, name: 'Google' },
{ value: 0, name: 'Union Ads' },
{ value: 0, name: 'Bing' },
{ value: 0, name: 'Video Ads' },
{ value: 0, name: 'Others' }
]
}
]
};

option && myChart.setOption(option);

Current Behavior

When all pie chart data are 0, the percentage is displayed as undefined

Expected Behavior

in v5.3.3, the percentage is displayed as 0

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@chiyu1996 chiyu1996 added the bug label Oct 10, 2022
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels Oct 10, 2022
@echarts-bot echarts-bot bot changed the title [Bug] Pie [Bug] Pie Oct 10, 2022
@chiyu1996 chiyu1996 changed the title [Bug] Pie [Bug] Pie Incorrect percentage display Oct 10, 2022
@plainheart
Copy link
Member

Thanks for your feedback. This bug has been fixed in #17734.

@plainheart plainheart added resolved topic: pie and removed pending We are not sure about whether this is a bug/new feature. labels Oct 10, 2022
@echarts-bot echarts-bot bot closed this as completed Oct 10, 2022
@plainheart plainheart linked a pull request Oct 10, 2022 that will close this issue
8 tasks
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 resolved topic: pie
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants