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
| var myChart = echarts.init(document.getElementById('echatrs1'));
| var myChart2 = echarts.init(document.getElementById('echatrs2'));
| // var myChart3 = echarts.init(document.getElementById('echatrs3'));
| // 使用刚指定的配置项和数据显示图表。
|
| // 指定图表的配置项和数据
| var option = {
| title: {
| // text: '点线面类型统计数量',
| textStyle: {
| color: '#fff',
|
| }
| },
| tooltip: {},
| legend: {
| // data: ['图斑类型'],
| textStyle: { //图例文字大小 颜色
| color: "#fff",
| fontSize: 10
| },
| x: '200'
| },
| grid: {
| top: 6,
| bottom: 19
| },
|
| xAxis: {
| data: [],
| axisLabel: { // x轴文本标签字体 颜色
| color: "#fff" //30eee9
| },
| axisLine: {
| show: true, //x轴线颜色
| lineStyle: {
| color: "#7CDCFF"
| },
| },
| axisTick: { show: false, }//x轴分割点
|
| },
| yAxis: {
| axisLabel: { // x轴文本标签字体 颜色
| color: "#fff" //30eee9
| },
| axisLine: {
| show: true, //x轴线颜色
| lineStyle: {
| color: "#7CDCFF"
| },
| },
| //设置网格线颜色
| splitLine: {
| show: true,
| lineStyle: {
| color: ['#315070'],
| width: 1,
| type: 'solid'
| }
| }
| },
| series: [{
| name: '图斑类型',
| type: 'bar',
| data: [],
| barWidth: 30,//柱图宽度
| itemStyle: {
| //通常情况下:
| normal: {
| barBorderRadius: 8,
| // //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
| // color: function (params) {
| // var colorList = [
| // ['#91D4FF', '#008AFF'],
| // // ['#F5cF0D', '#fa9203'],
| // // ['#61dbe8', '#0785de'],
| // // ['#ff9717', '#ff4518'],
| // ];
| // // var index = params.dataIndex;
| // // if (params.dataIndex >= colorList.length) {
| // // index = params.dataIndex - colorList.length;
| // // }
| // return new echarts.graphic.LinearGradient(0, 0, 0, 1,
| // [{
| // offset: 0,
| // color: colorList[0][0]
| // },
| // {
| // offset: 1,
| // color: colorList[0][1]
| // }
| // ]);
| // }
| },
| }
| }]
| };
| var lineoption = {
| title: {
| // text: '数据来源统计数量',
| textStyle: {
| color: '#fff',
|
| }
| },
| tooltip: {
| trigger: 'item'
| },
| legend: {
| // top: '5%',
| // left: 'center',
| y: 0,
| x: 0,
| textStyle: {
| color: '#fff',
| },
| orient: 'vertical',
| type: "scroll"
| },
| // color: ['#49AAFD', '#ED9F34'],
| series: [
| {
| name: '数据来源',
| type: 'pie',
| radius: ['40%', '60%'],
| avoidLabelOverlap: false,
| center:['260','center'],
| label: {
| show: false,
| position: 'center'
| },
| emphasis: {
| label: {
| show: true,
| fontSize: '12',
| fontWeight: 'bold',
| color: 'white'
| }
| },
| labelLine: {
| show: false
| },
| data: [
| // { value: 1048, name: '内部' },
| // { value: 735, name: '外部' },
|
| ]
| }
| ]
| };
|
|
| var pieoption = {
| title: {
| // text: '来源统计长度与面积',
| // subtext: '纯属虚构',
| left: 'center',
| textStyle: {
| color: '#fff',
| }
| },
| tooltip: {
| trigger: 'item'
| },
| legend: {
| orient: 'vertical',
| left: 'left',
| textStyle: { //图例文字大小 颜色
| color: "#fff",
| fontSize: 10
| }
| },
|
| color: ['#F76B7E', '#FFA63D'],
| series: [
| {
| name: '访问来源',
| type: 'pie',
| radius: '50%',
| data: [
|
| ],
| emphasis: {
| itemStyle: {
| shadowBlur: 10,
| shadowOffsetX: 0,
| shadowColor: 'rgba(0, 0, 0, 0.5)'
| }
| }
|
| }
| ]
| };
|
| // 请求数据,渲染图表
| PostAjax(IPurl + '/spcData/statistics?strName=图斑类型&type=1', '', function (params) {
| if (params.code == 500) {
| console.log(params.msg);
| return
| }
| // debugger
| // let arr = [params.data['点状'], params.data['线状'], params.data['面状']]
| // option.series[0].data = arr;
| var data = [];
| var legendData=[];
| for (var k in params.data) {
| if (k == "总数据") continue;
| if (k == "") continue;
| legendData.push(k);
| console.log(k, eval(`params.data['${k}']`));
| data.push({ name: k, value: eval(`params.data['${k}']`) });
| }
| option.xAxis.data=legendData;
| option.series[0].data = data;
| myChart.setOption(option);
| })
| // 请求数据,渲染图表
| PostAjax(IPurl + '/spcData/statistics?strName=数据来源&type=1', '', function (params) {
|
| if (params.code == 500) {
| console.log(params.msg);
| return
| }
| // let arr = [{ value: params.data['内部'], name: '内部' }, { value: params.data['外部'], name: '外部' }]
| // lineoption.series[0].data = arr;
| var data = [];
| for (var k in params.data) {
| if (k == "总数据") continue;
| if (k == "") continue;
| console.log(k, eval(`params.data['${k}']`));
| data.push({ name: k, value: eval(`params.data['${k}']`) });
| }
| lineoption.series[0].data = data;
| myChart2.setOption(lineoption);
|
| })
|
| // 请求数据,渲染图表
| PostAjax(IPurl + '/spcData/statistics', '', function (params) {
| if (params.code == 500) {
| console.log(params.msg);
|
| return
| }
| let arr = [{ value: params.data['长度'], name: '长度' }, { value: params.data['面积'], name: '面积' }]
| pieoption.series[0].data = arr;
| //myChart3.setOption(pieoption);
| })
|
| window.onresize = function () {
| for (var i = 0; i < MyCharts.length; i++) {
| MyCharts[i].resize();
| }
| for (var i = 0; i < myChart2.length; i++) {
| MyCharts2[i].resize();
| }
| for (var i = 0; i < myChart3.length; i++) {
| //myChart3[i].resize();
| }
| }
|
|