1、饼图
if (this.echartsRightDome != null) {
this.echartsRightDome.dispose();
}
this.echartsRightDome = this.$echarts.init(
document.getElementById('echartsRight')
);
performanceget().then((res) => {
let data = res.data;
let option = {
title: {
text: data.diskSize > 1024 ? (data.diskSize / 1024).toFixed(1) + 'TB' : data.diskSize + 'GB',
subtext: (data.usage * 100).toFixed(1) + '%',
x: 'center',
y: 'center',
// top: "150",
// left: "130",
textVerticalAlign: 'auto',
textStyle: {
fontStyle: 'italic', //主标题文字字体风格,默认normal,有italic(斜体),oblique(斜体)
color: '#000',
fontSize: 35,
fontWeight: 'bolder',
},
subtextStyle: {
fontStyle: 'italic',
color: '#ff',
fontSize: 30,
fontFamily: 'PingFangSC-Regular',
fontWeight: 'bolder',
},
itemGap: 35, //主副标题间距
},
series: [{
name: 'Line 2',
type: 'pie',
clockWise: true,
radius: ['0%', '50%'],
itemStyle: {
normal: {
label: {
show: false,
},
labelLine: {
show: false,
},
},
},
hoverAnimation: false,
data: [{
value: data.unFreeDiskSize,
name: '01',
itemStyle: {
normal: {
color: '#C1CCA2',
},
},
},
{
name: '02',
value: data.freeDiskSize,
itemStyle: {
normal: {
color: '#E0E5D0',
},
},
},
],
},
{
name: 'Line 1',
type: 'pie',
clockWise: true,
radius: ['50%', '64%'],
itemStyle: {
normal: {
label: {
show: false,
},
labelLine: {
show: false,
},
},
},
hoverAnimation: false,
data: [{
value: data.unFreeDiskSize,
name: '01',
itemStyle: {
normal: {
color: '#839946',
},
},
},
{
name: '02',
value: data.freeDiskSize,
itemStyle: {
normal: {
color: '#C1CCA2',
},
},
},
],
},
],
};
this.echartsRightDome.setOption(option);
});