echartsConfig.js
2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var dianLiangOne = {
// 标题(可选,可删除)
title: {
text: '',
left: 'center',
textStyle: {
color: '#ffffff', // 标题文字白色
},
},
// 提示框
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
textStyle: {
fontSize: 14,
},
},
grid: {
top: '13%',
left: '0.5%',
right: '3%',
bottom: '15%',
containLabel: true,
},
// 坐标轴
xAxis: {
type: 'category',
data: ['运行', '待机', '故障'], // X轴分类
axisLine: {
lineStyle: {
color: '#ffffff', // X轴线白色
},
},
axisLabel: {
color: '#ffffff', // X轴文字白色
fontSize: 14,
},
},
yAxis: {
type: 'value',
max: 100, // Y轴最大值100(百分比)
axisLine: {
lineStyle: {
color: '#ffffff', // Y轴线白色
},
},
axisLabel: {
color: '#ffffff', // Y轴文字白色
fontSize: 14,
formatter: '{value}%', // 显示百分比
},
splitLine: {
show: false,
lineStyle: {
color: 'rgba(255,255,255,0.2)', // 网格线半透明白色
},
},
},
// 系列数据
series: [
{
name: '状态占比',
type: 'bar',
barWidth: '40%', // 柱子宽度
data: [
{ value: 57, itemStyle: { color: '#00e068' } }, // 运行:绿色
{ value: 40, itemStyle: { color: '#ffb800' } }, // 待机:橙色
{ value: 3, itemStyle: { color: '#ff3333' } }, // 故障:红色
],
// 柱子上显示数值(百分比)
label: {
show: true,
position: 'top', // 数值显示在柱子顶部
color: '#ffffff', // 数值文字白色
fontSize: 14,
formatter: '{c}%',
},
},
],
}