@@ -4,11 +4,7 @@ import { format } from 'd3-format';
4
4
import { formatNumber } from 'utils/format' ;
5
5
import { getColorPalette } from 'utils/data' ;
6
6
7
- const EMISSIONS_KEYS = [
8
- 'Total including LUCF' ,
9
- 'Land-Use Change and Forestry' ,
10
- 'Agriculture'
11
- ] ;
7
+ const EMISSIONS_KEYS = [ 'Total including LUCF' , 'Land-Use Change and Forestry' ] ;
12
8
13
9
// get list data
14
10
const getData = state => state . data || null ;
@@ -42,14 +38,11 @@ export const parseData = createSelector([getSortedData], sortedData => {
42
38
const chartData = [ ] ;
43
39
data [ 0 ] . emissions . forEach ( ( item , i ) => {
44
40
const e1Value = item . value ;
45
- const e2Value = data [ 1 ] . emissions [ i ] . value ;
46
41
const totalEmissions = total . emissions [ i ] . value ;
47
42
chartData . push ( {
48
43
year : item . year ,
49
44
e1Value,
50
45
e1Percentage : e1Value / totalEmissions * 100 ,
51
- e2Value,
52
- e2Percentage : e2Value / totalEmissions * 100 ,
53
46
total : totalEmissions
54
47
} ) ;
55
48
} ) ;
@@ -74,15 +67,6 @@ export const parseConfig = createSelector(
74
67
background : false ,
75
68
activeDot : false ,
76
69
stackId : 1
77
- } ,
78
- e2Value : {
79
- fill : colorRange [ 1 ] ,
80
- stroke : colorRange [ 1 ] ,
81
- opacity : 1 ,
82
- strokeWidth : 0 ,
83
- background : false ,
84
- activeDot : false ,
85
- stackId : 1
86
70
}
87
71
}
88
72
} ,
@@ -99,15 +83,8 @@ export const parseConfig = createSelector(
99
83
} ,
100
84
{
101
85
key : 'e1Percentage' ,
102
- label : 'Agriculture' ,
103
- color : colorRange [ 0 ] ,
104
- unit : '%' ,
105
- unitFormat : value => format ( '.1f' ) ( value )
106
- } ,
107
- {
108
- key : 'e2Percentage' ,
109
86
label : 'Land-Use Change and Forestry' ,
110
- color : colorRange [ 1 ] ,
87
+ color : colorRange [ 0 ] ,
111
88
unit : '%' ,
112
89
unitFormat : value => format ( '.1f' ) ( value )
113
90
}
@@ -122,18 +99,9 @@ export const getSentence = createSelector(
122
99
if ( ! sortedData || ! sortedData . data . length ) return '' ;
123
100
const { positive, negative } = sentences ;
124
101
const { data, total } = sortedData ;
125
- const emissionsCount = data . reduce ( ( accumulator , item ) => {
126
- const accumulatorCount =
127
- typeof accumulator !== 'object'
128
- ? accumulator
129
- : accumulator . emissions
130
- . map ( a => a . value )
131
- . reduce ( ( iSum , value ) => iSum + value ) ;
132
- const itemCount = item . emissions
133
- . map ( a => a . value )
134
- . reduce ( ( iSum , value ) => iSum + value ) ;
135
- return accumulatorCount + itemCount ;
136
- } ) ;
102
+ const emissionsCount = data [ 0 ] . emissions
103
+ . map ( a => a . value )
104
+ . reduce ( ( iSum , value ) => iSum + value ) ;
137
105
const totalEmissionsCount = total . emissions . reduce (
138
106
( accumulator , item ) =>
139
107
( typeof accumulator !== 'object' ? accumulator : accumulator . value ) +
0 commit comments