安装npm install echarts
npm install echarts-liquidfill
<div id="liquidfill-chart" style="width:400px; height:400px"></div>
//局部引入
import * as echarts from 'echarts';
import 'echarts-liquidfill';
var chart = echarts.init(document.getElementById('liquidfill-chart'));
var option = {
series: [{
type: 'liquidFill',
data: [{
value: 3,
}, 0.5],
// color: ['#c5c5c5', 'rgb(0, 0, 255)', 'rgb(0, 0, 255)'],
label: {
formatter: '水位: {c}',
ontSize: 28
}
}]
};
chart.setOption(option);