Browse Source

第一部分 优化

wzl_h
guozhongbo 2 years ago
parent
commit
6b0599af06
1 changed files with 71 additions and 56 deletions
  1. 71
    56
      js/section_1.js

+ 71
- 56
js/section_1.js View File

1
-function initaveragescoreEcharts() {
1
+function initAverageScoreEcharts() {
2
   var itemStyle = {
2
   var itemStyle = {
3
     normal: {
3
     normal: {
4
       label: {
4
       label: {
12
   var curseries = [{
12
   var curseries = [{
13
       name: "满分",
13
       name: "满分",
14
       type: "bar",
14
       type: "bar",
15
-      barWidth: 32,
16
-      barMinHeight: 16,
15
+      barWidth: $.UnitUtil.mm2px(5),
16
+      // 柱状图最小高度
17
+      barMinHeight: $.UnitUtil.mm2px(2),
17
       barGap: 0,
18
       barGap: 0,
18
       data: [60, 70],
19
       data: [60, 70],
19
       itemStyle
20
       itemStyle
21
     {
22
     {
22
       name: "最高分",
23
       name: "最高分",
23
       type: "bar",
24
       type: "bar",
24
-      barWidth: 32,
25
-      barMinHeight: 16,
25
+      barWidth: $.UnitUtil.mm2px(5),
26
+      // 柱状图最小高度
27
+      barMinHeight: $.UnitUtil.mm2px(2),
26
       barGap: 0,
28
       barGap: 0,
27
       data: [50, 60],
29
       data: [50, 60],
28
       itemStyle
30
       itemStyle
30
     {
32
     {
31
       name: "最低分",
33
       name: "最低分",
32
       type: "bar",
34
       type: "bar",
33
-      barWidth: 32,
34
-      barMinHeight: 16,
35
+      barWidth: $.UnitUtil.mm2px(5),
36
+      // 柱状图最小高度
37
+      barMinHeight: $.UnitUtil.mm2px(2),
35
       barGap: 0,
38
       barGap: 0,
36
       data: [30, 40],
39
       data: [30, 40],
37
       itemStyle
40
       itemStyle
39
     {
42
     {
40
       name: "平均分",
43
       name: "平均分",
41
       type: "bar",
44
       type: "bar",
42
-      barWidth: 32,
43
-      barMinHeight: 16,
45
+      barWidth: $.UnitUtil.mm2px(5),
46
+      // 柱状图最小高度
47
+      barMinHeight: $.UnitUtil.mm2px(2),
44
       barGap: 0,
48
       barGap: 0,
45
       data: [40, 50],
49
       data: [40, 50],
46
       itemStyle
50
       itemStyle
47
     }
51
     }
48
   ];
52
   ];
49
   let option = {
53
   let option = {
54
+    animation: false,
50
     color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
55
     color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
51
     title: {
56
     title: {
52
       text: "分",
57
       text: "分",
54
       y: "top",
59
       y: "top",
55
       textStyle: {
60
       textStyle: {
56
         color: "#5F6E82",
61
         color: "#5F6E82",
57
-        fontSize: 12,
62
+        fontSize: $.UnitUtil.mm2px(3),
58
         fontWeight: 500
63
         fontWeight: 500
59
       }
64
       }
60
     },
65
     },
61
     legend: {
66
     legend: {
62
-      itemWidth: 6,
63
-      itemHeight: 6,
67
+      itemWidth: $.UnitUtil.mm2px(2),
68
+      itemHeight: $.UnitUtil.mm2px(2),
64
       top: "bottom",
69
       top: "bottom",
65
       data: curlegend
70
       data: curlegend
66
     },
71
     },
67
     grid: {
72
     grid: {
68
-      top: 30,
69
-      left: 5,
73
+      top: $.UnitUtil.mm2px(10),
74
+      left: 0,
70
       right: 0,
75
       right: 0,
71
-      bottom: "10%",
72
-      containLabel: true
76
+      bottom: $.UnitUtil.mm2px(8),
77
+      containLabel: true,
73
     },
78
     },
74
     xAxis: [{
79
     xAxis: [{
75
       type: "category",
80
       type: "category",
118
   myEcharts.setOption(option);
123
   myEcharts.setOption(option);
119
 }
124
 }
120
 
125
 
121
-function initexcellencerateEcharts() {
126
+function initExcellenceRateEcharts() {
122
   var itemStyle = {
127
   var itemStyle = {
123
     normal: {
128
     normal: {
124
       label: {
129
       label: {
132
   var curseries = [{
137
   var curseries = [{
133
       name: "优秀率",
138
       name: "优秀率",
134
       type: "bar",
139
       type: "bar",
135
-      barWidth: 32,
136
-      barMinHeight: 16,
140
+      barWidth: $.UnitUtil.mm2px(5),
141
+      // 柱状图最小高度
142
+      barMinHeight: $.UnitUtil.mm2px(2),
137
       barGap: 0,
143
       barGap: 0,
138
       data: [60, 70],
144
       data: [60, 70],
139
       itemStyle
145
       itemStyle
141
     {
147
     {
142
       name: "良好率",
148
       name: "良好率",
143
       type: "bar",
149
       type: "bar",
144
-      barWidth: 32,
145
-      barMinHeight: 16,
150
+      barWidth: $.UnitUtil.mm2px(5),
151
+      // 柱状图最小高度
152
+      barMinHeight: $.UnitUtil.mm2px(2),
146
       barGap: 0,
153
       barGap: 0,
147
       data: [50, 60],
154
       data: [50, 60],
148
       itemStyle
155
       itemStyle
150
     {
157
     {
151
       name: "及格率",
158
       name: "及格率",
152
       type: "bar",
159
       type: "bar",
153
-      barWidth: 32,
154
-      barMinHeight: 16,
160
+      barWidth: $.UnitUtil.mm2px(5),
161
+      // 柱状图最小高度
162
+      barMinHeight: $.UnitUtil.mm2px(2),
155
       barGap: 0,
163
       barGap: 0,
156
       data: [30, 40],
164
       data: [30, 40],
157
       itemStyle
165
       itemStyle
159
     {
167
     {
160
       name: "低分率",
168
       name: "低分率",
161
       type: "bar",
169
       type: "bar",
162
-      barWidth: 32,
163
-      barMinHeight: 16,
170
+      barWidth: $.UnitUtil.mm2px(5),
171
+      // 柱状图最小高度
172
+      barMinHeight: $.UnitUtil.mm2px(2),
164
       barGap: 0,
173
       barGap: 0,
165
       data: [40, 50],
174
       data: [40, 50],
166
       itemStyle
175
       itemStyle
167
     }
176
     }
168
   ];
177
   ];
169
   let option = {
178
   let option = {
179
+    animation: false,
170
     color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
180
     color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
171
     title: {
181
     title: {
172
       text: "分",
182
       text: "分",
174
       y: "top",
184
       y: "top",
175
       textStyle: {
185
       textStyle: {
176
         color: "#5F6E82",
186
         color: "#5F6E82",
177
-        fontSize: 12,
187
+        fontSize: $.UnitUtil.mm2px(3),
178
         fontWeight: 500
188
         fontWeight: 500
179
       }
189
       }
180
     },
190
     },
181
     legend: {
191
     legend: {
182
-      itemWidth: 6,
183
-      itemHeight: 6,
192
+      itemWidth: $.UnitUtil.mm2px(2),
193
+      itemHeight: $.UnitUtil.mm2px(2),
184
       top: "bottom",
194
       top: "bottom",
185
       data: curlegend
195
       data: curlegend
186
     },
196
     },
187
     grid: {
197
     grid: {
188
-      top: 30,
189
-      left: 5,
198
+      top: $.UnitUtil.mm2px(10),
199
+      left: 0,
190
       right: 0,
200
       right: 0,
191
-      bottom: "10%",
192
-      containLabel: true
201
+      bottom: $.UnitUtil.mm2px(8),
202
+      containLabel: true,
193
     },
203
     },
194
     xAxis: [{
204
     xAxis: [{
195
       type: "category",
205
       type: "category",
238
   myEcharts.setOption(option);
248
   myEcharts.setOption(option);
239
 }
249
 }
240
 
250
 
241
-function initexamnumEcharts() {
251
+function initExamnumEcharts() {
242
   var itemStyle = {
252
   var itemStyle = {
243
     normal: {
253
     normal: {
244
       label: {
254
       label: {
252
   var curseries = [{
262
   var curseries = [{
253
       name: "实考人数",
263
       name: "实考人数",
254
       type: "bar",
264
       type: "bar",
255
-      barWidth: 32,
256
-      barMinHeight: 16,
265
+      barWidth: $.UnitUtil.mm2px(5),
266
+      // 柱状图最小高度
267
+      barMinHeight: $.UnitUtil.mm2px(2),
257
       barGap: 0,
268
       barGap: 0,
258
       data: [60, 70],
269
       data: [60, 70],
259
       itemStyle
270
       itemStyle
261
     {
272
     {
262
       name: "缺考人数",
273
       name: "缺考人数",
263
       type: "bar",
274
       type: "bar",
264
-      barWidth: 32,
265
-      barMinHeight: 16,
275
+      barWidth: $.UnitUtil.mm2px(5),
276
+      // 柱状图最小高度
277
+      barMinHeight: $.UnitUtil.mm2px(2),
266
       barGap: 0,
278
       barGap: 0,
267
       data: [50, 60],
279
       data: [50, 60],
268
       itemStyle
280
       itemStyle
269
     }
281
     }
270
   ];
282
   ];
271
   let option = {
283
   let option = {
284
+    animation: false,
272
     color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
285
     color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
273
     title: {
286
     title: {
274
       text: "分",
287
       text: "分",
276
       y: "top",
289
       y: "top",
277
       textStyle: {
290
       textStyle: {
278
         color: "#5F6E82",
291
         color: "#5F6E82",
279
-        fontSize: 12,
292
+        fontSize: $.UnitUtil.mm2px(3),
280
         fontWeight: 500
293
         fontWeight: 500
281
       }
294
       }
282
     },
295
     },
283
     legend: {
296
     legend: {
284
-      itemWidth: 6,
285
-      itemHeight: 6,
297
+      itemWidth: $.UnitUtil.mm2px(2),
298
+      itemHeight: $.UnitUtil.mm2px(2),
286
       top: "bottom",
299
       top: "bottom",
287
       data: curlegend
300
       data: curlegend
288
     },
301
     },
289
     grid: {
302
     grid: {
290
-      top: 30,
291
-      left: 5,
303
+      top: $.UnitUtil.mm2px(10),
304
+      left: 0,
292
       right: 0,
305
       right: 0,
293
-      bottom: "10%",
294
-      containLabel: true
306
+      bottom: $.UnitUtil.mm2px(8),
307
+      containLabel: true,
295
     },
308
     },
296
     xAxis: [{
309
     xAxis: [{
297
       type: "category",
310
       type: "category",
354
   var curseries = [{
367
   var curseries = [{
355
     name: "标准差",
368
     name: "标准差",
356
     type: "bar",
369
     type: "bar",
357
-    barWidth: 32,
358
-    barMinHeight: 16,
370
+    barWidth: $.UnitUtil.mm2px(5),
371
+    // 柱状图最小高度
372
+    barMinHeight: $.UnitUtil.mm2px(2),
359
     barGap: 0,
373
     barGap: 0,
360
     data: [60, 70],
374
     data: [60, 70],
361
     itemStyle
375
     itemStyle
362
   }];
376
   }];
363
   let option = {
377
   let option = {
378
+    animation: false,
364
     color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
379
     color: ["#5C99FF", "#FF5F56", "#5EC5C8", "#f1982b"],
365
     title: {
380
     title: {
366
       text: "分",
381
       text: "分",
368
       y: "top",
383
       y: "top",
369
       textStyle: {
384
       textStyle: {
370
         color: "#5F6E82",
385
         color: "#5F6E82",
371
-        fontSize: 12,
386
+        fontSize: $.UnitUtil.mm2px(3),
372
         fontWeight: 500
387
         fontWeight: 500
373
       }
388
       }
374
     },
389
     },
375
     legend: {
390
     legend: {
376
-      itemWidth: 6,
377
-      itemHeight: 6,
391
+      itemWidth: $.UnitUtil.mm2px(2),
392
+      itemHeight: $.UnitUtil.mm2px(2),
378
       top: "bottom",
393
       top: "bottom",
379
       data: curlegend
394
       data: curlegend
380
     },
395
     },
381
     grid: {
396
     grid: {
382
-      top: 30,
383
-      left: 5,
397
+      top: $.UnitUtil.mm2px(10),
398
+      left: 0,
384
       right: 0,
399
       right: 0,
385
-      bottom: "10%",
386
-      containLabel: true
400
+      bottom: $.UnitUtil.mm2px(8),
401
+      containLabel: true,
387
     },
402
     },
388
     xAxis: [{
403
     xAxis: [{
389
       type: "category",
404
       type: "category",
435
   // outerHeight(true) 高度为 height+margin+padding+border
450
   // outerHeight(true) 高度为 height+margin+padding+border
436
   var parameter = $(".section_1_html_root").data("page-params");
451
   var parameter = $(".section_1_html_root").data("page-params");
437
   console.log("section_1:parameter", parameter);
452
   console.log("section_1:parameter", parameter);
438
-  initaveragescoreEcharts();
439
-  initexcellencerateEcharts();
440
-  initexamnumEcharts();
453
+  initAverageScoreEcharts();
454
+  initExcellenceRateEcharts();
455
+  initExamnumEcharts();
441
   initbzcEcharts();
456
   initbzcEcharts();
442
 });
457
 });

Loading…
Cancel
Save