@@ -69,7 +69,7 @@ class StackedBarGrouped extends PureComponent {
69
69
areas = series . map ( ( stack , stackIndex ) => {
70
70
return stack . map ( ( serie , keyIndex ) => {
71
71
return serie . map ( ( entry , entryIndex ) => {
72
- const leftMargin = series . length > 1 ? innerBarSpace / 2 : 0 ;
72
+ const leftMargin = series . length > 1 ? innerBarSpace / 2 : 0
73
73
const path = shape
74
74
. area ( )
75
75
. x0 ( d => x ( d [ 0 ] ) )
@@ -93,30 +93,29 @@ class StackedBarGrouped extends PureComponent {
93
93
areas = series . map ( ( stack , stackIndex ) => {
94
94
return stack . map ( ( serie , keyIndex ) => {
95
95
return serie . map ( ( entry , entryIndex ) => {
96
- const leftMargin = series . length > 1 ? innerBarSpace / 2 : 0 ;
97
- const x0 = x ( entryIndex ) + barWidth * stackIndex + leftMargin ;
98
- const x1 = x ( entryIndex ) + barWidth + barWidth * stackIndex - leftMargin ;
99
- const y0 = y ( entry [ 1 ] ) ;
100
- const y1 = y ( entry [ 0 ] ) ;
101
- const barHeight = y1 - y0 ;
102
- const borderRadius = initialBorderRadius * 2 > barHeight ? barHeight / 2 : initialBorderRadius ;
103
- const showTopBorder = keyIndex === stack . length - 1 ;
104
- const showBottomBorder = keyIndex === 0 ;
96
+ const leftMargin = series . length > 1 ? innerBarSpace / 2 : 0
97
+ const x0 = x ( entryIndex ) + barWidth * stackIndex + leftMargin
98
+ const x1 = x ( entryIndex ) + barWidth + barWidth * stackIndex - leftMargin
99
+ const y0 = y ( entry [ 1 ] )
100
+ const y1 = y ( entry [ 0 ] )
101
+ const barHeight = y1 - y0
102
+ const borderRadius = initialBorderRadius * 2 > barHeight ? barHeight / 2 : initialBorderRadius
103
+ const showTopBorder = keyIndex === stack . length - 1
104
+ const showBottomBorder = keyIndex === 0
105
105
const commands = this . coordinatesToPathCommands (
106
- x0 ,
107
- y0 ,
108
- x1 ,
109
- y1 ,
110
- borderRadius ,
111
- showTopBorder ,
112
- showBottomBorder ,
113
- ) ;
114
-
106
+ x0 ,
107
+ y0 ,
108
+ x1 ,
109
+ y1 ,
110
+ borderRadius ,
111
+ showTopBorder ,
112
+ showBottomBorder ,
113
+ )
115
114
return {
116
- path : this . commandsToSvgPath ( commands ) ,
117
- color : colors [ stackIndex ] [ keyIndex ] ,
118
- key : keys [ stackIndex ] [ keyIndex ] ,
119
- } ;
115
+ path : this . commandsToSvgPath ( commands ) ,
116
+ color : colors [ stackIndex ] [ keyIndex ] ,
117
+ key : keys [ stackIndex ] [ keyIndex ] ,
118
+ }
120
119
} )
121
120
} )
122
121
} )
@@ -133,68 +132,68 @@ class StackedBarGrouped extends PureComponent {
133
132
borderRadius ,
134
133
showTopBorder ,
135
134
showBottomBorder ,
136
- ) => {
137
- const commands = [ ] ;
138
- commands . push ( { marker : 'M' , values : [ x0 , y0 ] } ) ;
135
+ ) => {
136
+ const commands = [ ]
137
+ commands . push ( { marker : 'M' , values : [ x0 , y0 ] } )
139
138
140
139
if ( showTopBorder ) {
141
- const topLeft1 = [ x0 + borderRadius , y0 ] ;
142
- const topLeft2 = [ x0 , y0 + borderRadius ] ;
143
- commands . push ( { marker : 'L' , values : topLeft1 } ) ;
140
+ const topLeft1 = [ x0 + borderRadius , y0 ]
141
+ const topLeft2 = [ x0 , y0 + borderRadius ]
142
+ commands . push ( { marker : 'L' , values : topLeft1 } )
144
143
commands . push ( {
145
- marker : 'C' ,
146
- values : [ ...topLeft1 , x0 , y0 , ...topLeft2 ] ,
147
- } ) ;
148
- commands . push ( { marker : 'L' , values : topLeft2 } ) ;
144
+ marker : 'C' ,
145
+ values : [ ...topLeft1 , x0 , y0 , ...topLeft2 ] ,
146
+ } )
147
+ commands . push ( { marker : 'L' , values : topLeft2 } )
149
148
} else {
150
- commands . push ( { marker : 'L' , values : [ x0 , y0 ] } ) ;
149
+ commands . push ( { marker : 'L' , values : [ x0 , y0 ] } )
151
150
}
152
151
153
152
if ( showBottomBorder ) {
154
- const bottomLeft1 = [ x0 , y1 - borderRadius ] ;
155
- const bottomLeft2 = [ x0 + borderRadius , y1 ] ;
156
- commands . push ( { marker : 'L' , values : bottomLeft1 } ) ;
153
+ const bottomLeft1 = [ x0 , y1 - borderRadius ]
154
+ const bottomLeft2 = [ x0 + borderRadius , y1 ]
155
+ commands . push ( { marker : 'L' , values : bottomLeft1 } )
157
156
commands . push ( {
158
- marker : 'C' ,
159
- values : [ ...bottomLeft1 , x0 , y1 , ...bottomLeft2 ] ,
160
- } ) ;
161
- commands . push ( { marker : 'L' , values : bottomLeft2 } ) ;
162
- const bottomRight1 = [ x1 - borderRadius , y1 ] ;
163
- const bottomRight2 = [ x1 , y1 - borderRadius ] ;
164
- commands . push ( { marker : 'L' , values : bottomRight1 } ) ;
157
+ marker : 'C' ,
158
+ values : [ ...bottomLeft1 , x0 , y1 , ...bottomLeft2 ] ,
159
+ } )
160
+ commands . push ( { marker : 'L' , values : bottomLeft2 } )
161
+ const bottomRight1 = [ x1 - borderRadius , y1 ]
162
+ const bottomRight2 = [ x1 , y1 - borderRadius ]
163
+ commands . push ( { marker : 'L' , values : bottomRight1 } )
165
164
commands . push ( {
166
- marker : 'C' ,
167
- values : [ ...bottomRight1 , x1 , y1 , ...bottomRight2 ] ,
168
- } ) ;
169
- commands . push ( { marker : 'L' , values : bottomRight2 } ) ;
165
+ marker : 'C' ,
166
+ values : [ ...bottomRight1 , x1 , y1 , ...bottomRight2 ] ,
167
+ } )
168
+ commands . push ( { marker : 'L' , values : bottomRight2 } )
170
169
} else {
171
- commands . push ( { marker : 'L' , values : [ x0 , y1 ] } ) ;
172
- commands . push ( { marker : 'L' , values : [ x1 , y1 ] } ) ;
170
+ commands . push ( { marker : 'L' , values : [ x0 , y1 ] } )
171
+ commands . push ( { marker : 'L' , values : [ x1 , y1 ] } )
173
172
}
174
173
175
174
if ( showTopBorder ) {
176
- const topRight1 = [ x1 , y0 + borderRadius ] ;
177
- const topRight2 = [ x1 - borderRadius , y0 ] ;
178
- commands . push ( { marker : 'L' , values : topRight1 } ) ;
175
+ const topRight1 = [ x1 , y0 + borderRadius ]
176
+ const topRight2 = [ x1 - borderRadius , y0 ]
177
+ commands . push ( { marker : 'L' , values : topRight1 } )
179
178
commands . push ( {
180
- marker : 'C' ,
181
- values : [ ...topRight1 , x1 , y0 , ...topRight2 ] ,
182
- } ) ;
183
- commands . push ( { marker : 'L' , values : topRight2 } ) ;
179
+ marker : 'C' ,
180
+ values : [ ...topRight1 , x1 , y0 , ...topRight2 ] ,
181
+ } )
182
+ commands . push ( { marker : 'L' , values : topRight2 } )
184
183
} else {
185
- commands . push ( { marker : 'L' , values : [ x1 , y0 ] } ) ;
184
+ commands . push ( { marker : 'L' , values : [ x1 , y0 ] } )
186
185
}
187
186
188
- commands . push ( { marker : 'Z' , values : [ ] } ) ;
187
+ commands . push ( { marker : 'Z' , values : [ ] } )
189
188
190
- return commands ;
189
+ return commands
191
190
} ;
192
191
193
192
commandsToSvgPath = commands =>
194
193
commands
195
- . map ( command => `${ command . marker } ${ command . values . join ( ',' ) } ` )
196
- . join ( ' ' )
197
- . trim ( ) ;
194
+ . map ( command => `${ command . marker } ${ command . values . join ( ',' ) } ` )
195
+ . join ( ' ' )
196
+ . trim ( )
198
197
199
198
calcExtent ( values ) {
200
199
const {
0 commit comments