const option = ref({
dataset: {
source: [
['num', 'type'],
[20, 'CPU'],
[10, '硬盘'],
[50, '内存'],
[90, '数据库']
]
},
grid: {
left: '10%',
right: '10%',
bottom: '5%',
top:'20%',
containLabel: true
},
xAxis: {
type: 'category'
},
yAxis: {
type: 'value',
},
visualMap: {
orient: 'horizontal',
left: 'center',
top:'5%',
min: 0,
max: 100,
text: ['100%', '0%'],
dimension: 0,
inRange: {
color: ['#29CC39', '#FFCE34', '#D11A2A']
},
itemWidth: 10,
},
series: [
{
type: 'bar',
encode: {
x: 'type',
y: 'num'
},
barWidth: 25,
showBackground: true,
backgroundStyle: {
color: 'rgba(180, 180, 180, 0.2)'
},
itemStyle: {
borderRadius: 2
}
}
]
});