<div id="resource5" style="width:300px;height:250px;margin-top: 50px"></div>
var myChart5 = echarts.init(document.getElementById('resource5'));
var option5 = {
title: {
text: '标题',
x: 'center',
bottom: 220
},
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b}: {c} ({d}%)"
},
legend: {
show: false,
orient: 'vertical',
x: 'left',
data: ['已使用', '未使用'],
},
series: [
{
name: '总共CPU:'+vcoresTotal,
type: 'pie',
radius: ['60%', '80%'],
avoidLabelOverlap: false,
label: {
normal: {
show: true,
position: 'center',
formatter: function (argument) {
var html;
html = "已使用:" +vcoresRate+ "%";
return html;
},
textStyle: {
fontSize: 15,
color: '#D53A35'
}
}
},
labelLine: {
normal: {
show: false
}
},
data: [
{value: vcoresUsed, name: '已使用'},
{value: vcoresFree, name: '未使用'},
]
}
],
color: ['#D53A35', '#EEE5DE']
};
// 使用刚指定的配置项和数据显示图表。
myChart5.setOption(option5);