1
13693261870
2022-09-16 762f2fb45db004618ba099aa3c0bd89dba1eb843
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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
 
 
//通用主题
 
//柱子等颜色
var colors = ['#00ffff', '#ff5b00', '#00cfff', '#ff3000', '#00cfff', '#ff5b00', '#006ced', '#ffe000', '#ff3000', '#00ffff', '#ff5b00', '#00ffff', '#ff3000', '#00cfff', '#ff3000', '#006ced', '#ffe000', '#00ffff', '#ff5b00', '#00cfff', '#ffe000', '#006ced']
 
function getTheme(option) {
    option.backgroundColor = "";//背景色
    if (option.title.textStyle) {
        if (option.title.textStyle.color==="#fff") {
            option.title.textStyle = {  //标题的颜色 大小 对齐方式
                //align: 'center',
                color: option.title.textStyle.color,
                fontSize: 16,
            };
        } else {
            option.title.textStyle = {  //标题的颜色 大小 对齐方式
                //align: 'center',
                color: "#000",
                fontSize: 16,
            };
        }
    }
    else {
        option.title.textStyle = {  //标题的颜色 大小 对齐方式
            //align: 'center',
            color: "#000",
            fontSize: 16,
        };
    }
  
    //设置标题的位置
    option.title.left = "2%";
    option.title.top = "2%";
    option.tooltip.axisPointer = {
        type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
    };
 
if(option.legend.textStyle){
    if(option.legend.textStyle.color){
        if(option.legend.textStyle.color==="#fff"){
            option.legend.textStyle = {      //图例文字大小 颜色
                color: option.legend.textStyle.color,
                fontSize: 10
            };
        }else{
            option.legend.textStyle = {      //图例文字大小 颜色
                color: "#000",
                fontSize: 10
            };
        }
    }
}else{
    option.legend.textStyle = {      //图例文字大小 颜色
        color: "#000",
        fontSize: 10
    };
}
 
   
    //option.legend.itemWidth = 12;
 
    //option.legend.itemHeight = 10;
 
    //option.legend.right = 10;
 
    //option.legend.top = 50;
 
    //option.legend.itemGap = 16;
 
    //option.legend.width = "100%";
 
    //option.radiusAxis = {
    //    min: 40,
    //    max: 120,
    //    interval: 20,
    //    axisLine: {
    //        show: false,
    //        lineStyle: {
    //            color: "#0B3E5E",
    //            width: 1,
    //            type: "solid"
    //        },
    //    },
    //option.xAxis.nameRotate = 45;
    option.xAxis.axisTick = { alignWithLable: true }; //x轴分割点
if(option.xAxis.axisLabel){
    if(option.xAxis.axisLabel.color){
        if(option.xAxis.axisLabel.color==="#fff"){
            option.xAxis.axisLabel = {  // y轴文本标签字体 颜色
                textStyle: {
                    //fontFamily: 'Roboto-Regular',
                    //fontWeight: "bolder"
                },
                color: option.xAxis.axisLabel.color //30eee9
            };
        }else{
            option.xAxis.axisLabel = {  // x轴文本标签字体 颜色
                textStyle: {
                    //fontFamily: 'Roboto-Regular',
                    //fontWeight: "bolder",
                },
                color: "#000" //30eee9
            };
        }
    }
}else{
    option.xAxis.axisLabel = {  // x轴文本标签字体 颜色
        textStyle: {
            //fontFamily: 'Roboto-Regular',
            //fontWeight: "bolder",
        },
        color: "#000" //30eee9
    };
}
   
    
   
    option.xAxis.boundaryGap = true;
//debugger
if(option.xAxis.axisLine){
    if(option.xAxis.axisLine.lineStyle){
        if(option.xAxis.axisLine.lineStyle.color){
            if(option.xAxis.axisLine.lineStyle.color==="#fff"){
                option.xAxis.axisLine = {
                    show: true,           //x轴线颜色
                    lineStyle: {
                        color: option.xAxis.axisLine.lineStyle.color
                    },
            
                };
            }else{
                option.xAxis.axisLine = {
                    show: true,           //x轴线颜色
                    lineStyle: {
                        color: "#5d7289"
                    },
            
                };
            }
        }
    }
}
else{
    option.xAxis.axisLine = {
        show: true,           //x轴线颜色
        lineStyle: {
            color: "#5d7289"
        },
 
    };
}  
 
if(option.yAxis.axisLine){
    if(option.yAxis.axisLine.lineStyle){
        if(option.yAxis.axisLine.lineStyle.color){
            if(option.yAxis.axisLine.lineStyle.color==="#fff"){
                option.yAxis.axisLine = {
                    show: true,           //y轴线颜色
                    lineStyle: {
                        color: option.yAxis.axisLine.lineStyle.color
                    },
            
                };
            }else{
                option.yAxis.axisLine = {     //y轴线颜色
                    show: true,
                    lineStyle: {
                        color: "#5d7289"
                    }
                };
            }
        }
    }
}   
else{
    option.yAxis.axisLine = {     //y轴线颜色
        show: true,
        lineStyle: {
            color: "#5d7289"
        }
    }; 
}
 
 
    
    //条形图
    if (option.yAxis[0]) {
        option.yAxis[0].axisLine = {     //y轴线颜色
            show: true,
            lineStyle: {
                color: "#5d7289"
            }
        };
    }
 
    option.xAxis.axisTick = {//设置x轴的刻度显示
        show: true
    };
    if(option.yAxis.axisLabel){
        if(option.yAxis.axisLabel.color){
            if(option.yAxis.axisLabel.color==="#fff"){
                option.yAxis.axisLabel = {  // y轴文本标签字体 颜色
                    textStyle: {
                        //fontFamily: 'Roboto-Regular',
                        //fontWeight: "bolder"
                    },
                    color: option.yAxis.axisLabel.color //30eee9
                };
            }else{
                option.yAxis.axisLabel = {  // y轴文本标签字体 颜色
                    textStyle: {
                        //fontFamily: 'Roboto-Regular',
                        //fontWeight: "bolder"
                    },
                    color: "#000" //30eee9
                };
            }
        }
    }else{
        option.yAxis.axisLabel = {  // y轴文本标签字体 颜色
            textStyle: {
                //fontFamily: 'Roboto-Regular',
                //fontWeight: "bolder"
            },
            color: "#000" //30eee9
        };
    }
    
    
    // y轴分割线
    //for (var i = 0; i < option.yAxis.length; i++) {
    //    if (i = 1) { continue;} //取消右侧y轴显示
    //    if (option.yAxis[i]) {
    //        option.yAxis[i].splitLine = {
    //            show: true,
    //            lineStyle: {
    //                color: "#5d7289",
    //                width: 2,
    //                type: "bolid"
    //            }
    //        }
    //    };
 
 
    //}
    //if (option.yAxis) {
    //    option.yAxis.splitLine = {
    //        lineStyle: {
    //            show: true,
    //    color: "#5d7289",
    //    width: 2,
    //    type: "bolid"
    //}
    //}}
  
 
    //使x轴字体倾斜
    option.xAxis.axisLabel.rotate = 40;
    option.grid = { x:"12%" };
  
    //option.legend = '';   //设置图例为空
     //option.backgroundColor = "white";
 
    return option;
};
//饼状图的配置
function getpieTheme(option) {
    option.backgroundColor = "transparent";
 
    option.grid = { y2: '22%', y: '17%' };
    //设置标题的位置
    option.title.left = "2%";
    option.title.top = "2%";
    option.title.color = "#000";
    if (option.series[0]) {
        //设置饼状图的位置
        // option.series[0].center = ['36%', '50%'];
        option.series[0].center = ['50%', '50%'];
        //设置饼状图的标签线不显示
        option.series[0].labelLine = {
            normal: {
                length: 10,
                length2: 20,
                smooth: false,
                show: false
            }
        },
          option.series[0].label = {
              normal: { show: false }
          }
    } else {
        option.series.labelLine={
            normal: {
                length: 10,
                length2: 20,
                smooth: false,
                show:false
            }
        },
      option.series.label = {
        normal: {         
           show: false
            }
        }
    }
  
    option.title.textStyle.fontSize = 16; //设置标题的字体大小
    if (option.legend)
    {
        option.legend.color = "#000";
    }
 
    return option;
};