ddx2019 removed a comment on issue #10400:
URL: https://github.com/apache/echarts/issues/10400#issuecomment-863088960
formatter一下,保留一位小数能解决echarts饼图的
相同数字不同百分比的情况,目前采取的是这种解决方式;如有更好的方法,请大佬告知。参数:option = {
title: {
text: "某站点用户访问来源",
subtext: "纯属虚构",
left: "center"
},
tooltip: {
trigger: "item",
// formatter:"{a} <br/>{b} : {c} ({d}%)"
formatter: function(data) {
const { name, value } = data.data;
const { seriesName, percent } = data;
return `${seriesName}<br/>${name}: ${value} (${percent.toFixed(1)}%)`;
}
},
legend: {
orient: "vertical",
left: "left"
},
series: [
{
name: "访问来源",
type: "pie",
radius: "50%",
data: [
{ value: 1048, name: "搜索引擎" },
{ value: 735, name: "直接访问" },
{ value: 580, name: "邮件营销" },
{ value: 300, name: "联盟广告" },
{ value: 300, name: "视频广告" }
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)"
}
}
}
]
};
https://echarts.apache.org/v4/examples/zh/editor.html?c=pie-simple
旧版本echarts (v4)
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]