echartsConfig_CS.js
6.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
var warehouseHealthOption = {
color: ["rgb(3, 205, 249)", "rgb(210, 252, 60)", "#f43d33"],
tooltip: {
trigger: "axis",
// 鼠标放上去显示百分比
// formatter: '{c}%',
formatter: function(params) {
var result = params[0].name + "<br>";
params.forEach(function(item) {
if (item.value) {
result += item.marker + " " + item.value + "%</br>";
} else {
result += item.marker + " - </br>";
}
});
return result;
},
axisPointer: {
// Use axis to trigger tooltip
type: "shadow", // 'shadow' as default; can also be 'line' or 'shadow'
},
},
legend: {},
grid: {
top: "18%",
left: "1%",
right: "3%",
bottom: "1%",
containLabel: true,
},
xAxis: {
type: "category",
axisLabel: {
textStyle: {
color: "#fff",
},
},
axisLine: {
lineStyle: {
color: "#afa3a3", // X轴线的颜色
width: 1, // x轴线的宽度
},
},
data: [],
},
yAxis: {
type: "value",
min: 0, //最小百分比
max: 100, //最大百分比
splitLine: true,
axisTick: {
show: true,
alignWithLabel: true,
},
axisLabel: {
show: true,
interval: "auto",
formatter: "{value}%", //y轴数值,带百分号
textStyle: {
color: "#fff",
},
},
axisLine: {
lineStyle: {
color: "#afa3a3", // y轴线的颜色
width: 1, // y轴线的宽度
},
},
},
series: [
{
type: "bar",
barWidth: "23%",
stack: "Ad",
emphasis: {
focus: "series",
},
itemStyle: {
normal: {
label: {
show: false, //开启显示数值
formatter: function(params) {
//标签内容
return params.value + "%";
},
position: "bottom", //数值在上方显示
textStyle: {
//数值样式
color: "#fff", //字体颜色
fontSize: 19, //字体大小
},
},
},
},
data: [],
},
{
type: "bar",
stack: "Ad",
emphasis: {
focus: "series",
},
itemStyle: {
normal: {
label: {
show: false, //开启显示数值
formatter: function(params) {
//标签内容
return params.value + "%";
},
position: "bottom", //数值在上方显示
textStyle: {
//数值样式
color: "#000000", //字体颜色
fontSize: 10, //字体大小
},
},
},
},
data: [],
},
{
type: "bar",
stack: "Ad",
emphasis: {
focus: "series",
},
itemStyle: {
normal: {
label: {
show: true, //开启显示数值
formatter: function(params) {
//标签内容
return params.value + "%";
},
position: "top", //数值在上方显示
textStyle: {
//数值样式
color: "#ffff", //字体颜色
// fontSize: 10, //字体大小
},
},
},
},
data: [],
},
],
};
var WarehouseTrendChartOpton = {
title: {
left: 10,
top: 10,
text: "當月各自倉運行趨勢圖",
textStyle: {
color: "aliceblue",
fontSize: 12,
// fontStyle: 'oblique',
},
},
tooltip: {
show: true,
trigger: "axis",
// 鼠标放上去显示百分比
formatter: function(params) {
var relVal = params[0].name; //x轴对应的名字
for (var i = 0, l = params.length; i < l; i++) {
//legend对应的名字
relVal += "<br/>" + params[i].marker + params[i].seriesName + ": " + params[i].value + "%";
}
return relVal;
},
// formatter: '{b0}<br/>{a0}: {c0}%<br />',
},
legend: {
show: true,
data: [],
top: 10,
right: 10,
itemHeight: 8,
itemWidth: 12,
textStyle: {
//图例字体大小
fontSize: 8,
fontWeight: "bolder",
color: "aliceblue",
},
},
grid: {
left: "3%",
top: "20%",
right: "4%",
bottom: "3%",
// 是否显示刻度标签
containLabel: true,
},
xAxis: {
type: "category",
boundaryGap: false,
axisLabel: {
textStyle: {
color: "#fff",
},
},
axisLine: {
lineStyle: {
color: "#fff", // X轴线的颜色
width: 1, // x轴线的宽度
},
},
data: [],
},
yAxis: {
//y轴大小值
min: 0,
//最大值根据 data显示最高高度
// max: function(value) {
// return value.max
// },
max: 100,
type: "value",
// 百分比
axisLabel: {
formatter: "{value} %",
textStyle: {
color: "#fff",
},
},
axisLine: {
// 坐标轴 轴线
// symbol: ['none', 'arrow'], // 是否显示轴线箭头
show: true, // 是否显示
lineStyle: {
color: "#fff", // y轴线的颜色
width: 1, // y轴线的宽度
},
},
axisTick: {
// 坐标轴的刻度
show: true, // 是否显示
inside: false, // 是否朝内
length: 5, // 长度
lineStyle: {
color: "#ccc", // 默认取轴线的颜色
width: 1,
type: "solid",
},
},
},
series: [
{
name: 'Email',
type: 'line',
stack: 'Total',
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: 'Union Ads',
type: 'line',
stack: 'Total',
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: 'Video Ads',
type: 'line',
stack: 'Total',
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: 'Direct',
type: 'line',
stack: 'Total',
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: 'Search Engine',
type: 'line',
stack: 'Total',
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
],
};
//需要用到的页面 接收 import {xxOption} from '../static/echartsConfig'