水球图主要用来展示百分比的数据 如图:
但是在实际需求中可能需要展示具体数据 如图:
const data = ["188"];
let option = {
title: {
text: "当前借阅情况",
left: "center",
},
series: [
{
type: "liquidFill",
radius: "60%",
data: [".4"],
color: "rgba(67,209,100,1)",
label: {
normal: {
color: "#fff",
insideColor: "transparent",
textStyle: {
fontSize: 20,
fontWeight: "bold",
fontFamily: "Microsoft YaHei",
},
formatter: function () {
return data + "套";
},
},
},
},
],
};
其中,series下的data用来展示水波的多少,下方formatter函数中的使用的是最上面声明的具体数量,然后拼接需要的字段。
最后:代码有删减,不等于实际使用的展示效果,本人是菜鸡,只是看到网络上没有看到这部分资料,这个代码也简单,就随手贴上,感谢阅读!