|
|
@@ -2,7 +2,7 @@
|
|
2
|
2
|
* @Author: dayan_hjm 碳排放
|
|
3
|
3
|
* @Date: 2023-10-23 09:32:12
|
|
4
|
4
|
* @Last Modified by: dayan_hjm
|
|
5
|
|
- * @Last Modified time: 2023-11-01 15:01:37
|
|
|
5
|
+ * @Last Modified time: 2023-11-02 15:51:27
|
|
6
|
6
|
*/
|
|
7
|
7
|
|
|
8
|
8
|
|
|
|
@@ -10,9 +10,12 @@ import React, { useState, useEffect, Component } from "react";
|
|
10
|
10
|
import styles from "../style.less";
|
|
11
|
11
|
import { useHistory, useLocation, withRouter } from "react-router-dom";
|
|
12
|
12
|
import mod from '../mod';
|
|
|
13
|
+
|
|
|
14
|
+import { getArrMax } from "@utils/util";
|
|
13
|
15
|
import {
|
|
14
|
16
|
dataengineCenterOneservice,
|
|
15
|
17
|
} from "../api";
|
|
|
18
|
+import { get, } from "lodash";
|
|
16
|
19
|
|
|
17
|
20
|
@withRouter
|
|
18
|
21
|
|
|
|
@@ -22,18 +25,36 @@ class RightBottomView extends Component {
|
|
22
|
25
|
super(props, context);
|
|
23
|
26
|
this.store = mod;
|
|
24
|
27
|
this.state = {
|
|
|
28
|
+ missionsTotal_arr:[],
|
|
|
29
|
+ year:[],
|
|
|
30
|
+ missionsIntensity_arr:[],
|
|
|
31
|
+ max1:0,
|
|
|
32
|
+ max2:0,
|
|
25
|
33
|
};
|
|
26
|
34
|
}
|
|
27
|
35
|
|
|
28
|
36
|
componentDidMount() {
|
|
29
|
37
|
this.getUrl()
|
|
30
|
|
- this.setData();
|
|
31
|
|
- this.setData2();
|
|
32
|
38
|
}
|
|
33
|
39
|
|
|
34
|
|
- getUrl(){
|
|
35
|
|
- dataengineCenterOneservice().then(({ data, resultCode }) => {
|
|
|
40
|
+ async getUrl(){
|
|
|
41
|
+ await dataengineCenterOneservice().then(({ data=[], resultCode }) => {
|
|
36
|
42
|
if (+resultCode === 0) {
|
|
|
43
|
+ let year = [],missionsIntensity_arr = [],missionsTotal_arr = [],max1=[],max2=[];
|
|
|
44
|
+ data.map((x,i)=>{
|
|
|
45
|
+ year.unshift(x.byear)
|
|
|
46
|
+ missionsIntensity_arr.unshift(x.missionsIntensity)
|
|
|
47
|
+ missionsTotal_arr.unshift(x.missionsTotal)
|
|
|
48
|
+ });
|
|
|
49
|
+ const max_1 = getArrMax(missionsIntensity_arr);
|
|
|
50
|
+ const max_2 = getArrMax(missionsTotal_arr);
|
|
|
51
|
+ for (let index = 0; index < data.length; index++) {
|
|
|
52
|
+ max1.unshift(max_1/0.8)
|
|
|
53
|
+ max2.unshift(max_2/0.8)
|
|
|
54
|
+ }
|
|
|
55
|
+ this.setState({year,missionsIntensity_arr,missionsTotal_arr,max1,max2});
|
|
|
56
|
+ this.setData();
|
|
|
57
|
+ this.setData2();
|
|
37
|
58
|
}
|
|
38
|
59
|
});
|
|
39
|
60
|
|
|
|
@@ -68,7 +89,7 @@ class RightBottomView extends Component {
|
|
68
|
89
|
fontFamily: 'DingTalkJinBuTi',
|
|
69
|
90
|
}
|
|
70
|
91
|
},
|
|
71
|
|
- data: ['2020', '2021', '2022']
|
|
|
92
|
+ data: this.state.year
|
|
72
|
93
|
|
|
73
|
94
|
},
|
|
74
|
95
|
{
|
|
|
@@ -100,7 +121,7 @@ class RightBottomView extends Component {
|
|
100
|
121
|
name: '条',
|
|
101
|
122
|
type: 'bar',
|
|
102
|
123
|
yAxisIndex: 0,
|
|
103
|
|
- data: [88, 73, 34],
|
|
|
124
|
+ data: this.state.missionsTotal_arr,
|
|
104
|
125
|
label: {
|
|
105
|
126
|
normal: {
|
|
106
|
127
|
show: true,
|
|
|
@@ -135,7 +156,7 @@ class RightBottomView extends Component {
|
|
135
|
156
|
type: 'bar',
|
|
136
|
157
|
yAxisIndex: 1,
|
|
137
|
158
|
barGap: '-100%',
|
|
138
|
|
- data: [99.5, 99.5, 99.5],
|
|
|
159
|
+ data: this.state.max2,
|
|
139
|
160
|
barWidth: 23,
|
|
140
|
161
|
itemStyle: {
|
|
141
|
162
|
normal: {
|
|
|
@@ -163,7 +184,6 @@ class RightBottomView extends Component {
|
|
163
|
184
|
var myChart = echarts.init(document.getElementById('echarts9'));
|
|
164
|
185
|
var myColor = ['#eb2100', '#eb3600', '#d0570e', '#d0a00e', '#34da62', '#00e9db', '#00c0e9', '#0096f3'];
|
|
165
|
186
|
var option = {
|
|
166
|
|
-
|
|
167
|
187
|
grid: {
|
|
168
|
188
|
left: '0%',
|
|
169
|
189
|
top: '15%',
|
|
|
@@ -209,7 +229,7 @@ class RightBottomView extends Component {
|
|
209
|
229
|
name: '条',
|
|
210
|
230
|
type: 'bar',
|
|
211
|
231
|
yAxisIndex: 0,
|
|
212
|
|
- data: [25, 55, 88],
|
|
|
232
|
+ data: this.state.missionsIntensity_arr,
|
|
213
|
233
|
animation:true,
|
|
214
|
234
|
animationDuration:3000,
|
|
215
|
235
|
smooth: true,
|
|
|
@@ -246,7 +266,7 @@ class RightBottomView extends Component {
|
|
246
|
266
|
type: 'bar',
|
|
247
|
267
|
yAxisIndex: 1,
|
|
248
|
268
|
barGap: '-100%',
|
|
249
|
|
- data: [99.5, 99.5, 99.5],
|
|
|
269
|
+ data: this.state.max1,
|
|
250
|
270
|
animation:true,
|
|
251
|
271
|
animationDuration:3000,
|
|
252
|
272
|
smooth: true,
|