ansel0926
2022-05-17 7e640af3bb0da07b6db6497b4188ef40322e8694
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
//var Xdata=['硫化氢', '二氧化硫', '硫醇', '硫脒', '氨气', 
//         '三甲胺', '甲苯', '二甲苯', '甲硫醇', '甲硫醇', '氨气',"二氧化氮","一氧化氮"];
 
var Xdata=['1号', '3号', '5号', '7号', '9号', 
           '11号', '13号', '15号', '17号', '19号', '21号',"25号","29号"]; 
 
var fp_jzrk = {
    "1月": [589, 259, 262, 324, 232, 176, 196, 214, 133, 370, 120,144,253],
    "2月": [511, 315, 139, 375, 204, 352, 163, 258, 385, 209, 100,55,243],
    "3月": [527, 210, 328, 292, 241, 110, 130, 185, 392, 392, 220,133,166],
    "4月": [500, 350, 300, 250, 200, 150, 100, 150, 200, 250, 280,321,134],
    "5月": [580, 128, 255, 254, 313, 143, 360, 343, 338, 163, 125,178,155],
    "6月": [480, 118, 245, 244, 340, 141, 364, 342, 335, 166, 115,158,165],
    "7月": [580, 128, 255, 254, 313, 143, 310, 373, 331, 163, 125,178,155],
    "8月": [510, 118, 265, 254, 313, 133, 320, 353, 318, 141, 165,178,155],
    "9月": [560, 128, 255, 254, 323, 126, 360, 333, 345, 133, 125,178,145],
    "10月": [543, 128, 255, 232, 313, 143, 342, 365, 338, 123, 165,139,135],
    "11月": [560, 128, 255, 224, 313, 142, 363, 313, 338, 113, 126,166,125],
    "12月": [530, 128, 255, 218, 313, 131, 355, 333, 338, 173, 128,138,165]
};
var fp_jzfyb = {
    "1月": [589, 259, 262, 324, 232, 176, 196, 214, 133, 370, 120,144,253],
    "2月": [511, 315, 139, 375, 204, 352, 163, 258, 385, 209, 100,55,243],
    "3月": [527, 210, 328, 292, 241, 110, 130, 185, 392, 392, 220,133,166],
    "4月": [500, 350, 300, 250, 200, 150, 100, 150, 200, 250, 280,321,134],
    "5月": [580, 128, 255, 254, 313, 143, 360, 343, 338, 163, 125,178,155],
    "6月": [480, 118, 245, 244, 340, 141, 364, 342, 335, 166, 115,158,165],
    "7月": [580, 128, 255, 254, 313, 143, 310, 373, 331, 163, 125,178,155],
    "8月": [510, 118, 265, 254, 313, 133, 320, 353, 318, 141, 165,178,155],
    "9月": [560, 128, 255, 254, 323, 126, 360, 333, 345, 133, 125,178,145],
    "10月": [543, 128, 255, 232, 313, 143, 342, 365, 338, 123, 165,139,135],
    "11月": [560, 128, 255, 224, 313, 142, 363, 313, 338, 113, 126,166,125],
    "12月": [530, 128, 255, 218, 313, 131, 355, 333, 338, 173, 128,138,165]
};
//图表月份
var timeLineData = ["1月", "2月", "3月", "4月", 
      "5月","6月","7月","8月","9月","10月","11月","12月"];
option = { 
 baseOption: {
     backgroundColor: "#061740",
     timeline: {
         show: true,
         axisType: 'category',
         tooltip: {
             show: true,
             formatter: function(params) {
                 return params.name + '月份数据统计';
             }
         },
         autoPlay: true,
         currentIndex: 10,
         playInterval: 2000,
         label: {
             normal: {
                 show: true,
                 color: '#20dbfd',
                 interval: 'auto',
                 formatter: function(params) {
                     return params
                 }
             },
         },
         lineStyle: {
             show: true,
             color: '#20dbfd'
         },
         itemStyle: {
             show: true,
             color: '#20dbfd'
         },
         controlStyle: {
             show: true,
             color: '#20dbfd',
             borderColor: '#20dbfd'
         },
         left: "0",
         right: "0",
         bottom: '0',
         padding: [15, 0],
         data: timeLineData,
     },
     title: {
         textStyle: {
             color: '#fff',
             fontSize: 16,
         },
     },
     tooltip: {
         show: true,
         trigger: 'axis',
         axisPointer: {
             type: 'shadow',
         }
     },
     grid: {
         top: "10%",
         left: "1%",
         right: "1%",
         bottom: "10%",
         containLabel: true
     },
 
     xAxis: [{
         type: 'category',
         axisLine: {
             show: false,
         },
         axisTick: {
             show: false,
         },
         axisLabel: {
             show: true,
             formatter: function(val) {
                 var strs = val.split(''); //字符串数组
                 var str = ''
                 for (var i = 0, s; s = strs[i++];) { //遍历字符串数组
                     str += s;
                     if (!(i % 2)) str += '\n'; //按需要求余
                 }
                 return str
             },
             textStyle: {
                 color: '#fff',
                 fontSize: 12,
             },
         },
         splitLine: {
             show: false,
             lineStyle: {
                 color: '#fff',
                 width: 1,
             },
         },
         data: Xdata,
     }],
     yAxis: [{
             type: 'value',
             name: "(ml/M3)",
             nameTextStyle: {
                 color: "#fff",
             },
             axisLine: {
                 show: false
             },
             axisTick: {
                 show: false
             },
             axisLabel: {
                 show: true,
                 color: '#ccc',
                 textStyle: {
                     color: '#fff',
                     fontSize: 12,
                 },
 
             }
         },
         {
             type: 'value',
             name: "数值",
             nameTextStyle: {
                 color: "#fff",
             },
             position: "right",
             axisLine: {
                 show: false
             },
             axisTick: {
                 show: false
             },
             axisLabel: {
                 show: true,
                 textStyle: {
                     color: '#fff',
                     fontSize: 12,
                 },
 
             }
         }
     ]
 },
 options: []
};
for (var i = 0; i < timeLineData.length; i++) {
 option.options.push({
     series: [{
             name: '各异味指数据',
             type: 'bar',
             barWidth: '20%',
             label: {
                 normal: {
                     show: false,
                     color: '#fff',
                     textStyle: {
                         color: '#fff',
                         fontSize: 12,
                     },
                 },
                 emphasis: {
                     show: false,
                     offset: [0, 0],
                     textStyle: {
                         color: '#fff'
                     },
                 },
             },
             itemStyle: {
                 color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                     offset: 0,
                     color: 'rgba(0,244,255,1)' // 0% 处的颜色
                 }, {
                     offset: 1,
                     color: 'rgba(0,77,167,1)' // 100% 处的颜色
                 }], false),
                 barBorderRadius: [30, 30, 30, 30],
                 shadowColor: 'rgba(0,160,221,1)',
                 shadowBlur: 4,
                 emphasis: {
                     opacity: 1,
                 },
             },
             data: fp_jzrk[timeLineData[i]],
         },
         {
             name: "",
             type: "line",
             yAxisIndex: 1,
             smooth: true, //平滑曲线显示
             showAllSymbol: true, //显示所有图形。
             symbol: "circle", //标记的图形为实心圆
             symbolSize: 8, //标记的大小
             itemStyle: {
                 color: "#DC3AFF",
                 borderColor: "#DC3AFF",
             },
             lineStyle: {
                 color: "#DC3AFF",
                 shadowColor: "#3D7EEB",
                 shadowBlur: 4
             },
             data: fp_jzfyb[timeLineData[i]]
         },
     ]
 });
}
echarts.init(document.getElementById("div_timedata")).setOption(option);