echarts水球图
用的是echarts-liquidfill
我的版本是这样
"echarts-liquidfill": "2.0.6"
// An highlighted block
var chartDom = document.getElementById('circularScore');
if (chartDom) {
// console.log(chartDom, 'chartDom');
var value = (score / 100).toFixed(4);//我个人需要的值
var myChart = echarts.init(chartDom);
var option;
option = {
series: [
{
backgroundStyle: {
undefined,
color: '#616161', // 水球未到的背景颜色
opacity: 0.9,
},
type: 'liquidFill',
radius: '80%',
// z: 1,
center: ['50%', '50%'],
amplitude: 20,
color: [
{
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: '#cdae84',
},
{
offset: 1,
color: '#d6c9b6',
},
],
},
],
data: [
{
value: value,
direction: 'left',
label: {
normal: {
textStyle: {
color: '#cfcbcb',
fontSize: 50
}
}
}
},
],
label: {
formatter: function (params) {
return (params.value * 100 ).toFixed(2);//水球上面的数字
},
fill: '#fff',
},
outline: {
// 是否显示外圈
show: false,
},
},
],
};
option && myChart.setOption(option);
}
大致内容就是这样了,可以做个参考