@@ -102,14 +102,14 @@ const BarGraphComparison = (props) => {
102
102
const getSnapshotId = ( d : snapshot ) => d . snapshotId ;
103
103
const formatSnapshotId = ( id ) => `Snapshot ID: ${ id } ` ;
104
104
const formatRenderTime = ( time ) => `${ time } ms ` ;
105
-
105
+ const getTabID = ( storedSeries ) => storedSeries . currentTab ;
106
106
// create visualization SCALES with cleaned data
107
+ //const xAxisPoints = [...titleFilter(comparison).map(getTabID), currentTab];
107
108
//the domain array elements will place the bars along the x-axis
109
+ const xAxisPoints = [ 'currentTab' , 'comparison' ] ; //[1.0.,2.0]
110
+ //{ currentTab : 1 }, {currentTab : 2 }
108
111
const snapshotIdScale = scaleBand < string > ( {
109
- domain : [
110
- `Current Tab Series` ,
111
- `Series ${ ! comparison [ series ] ? null : series + 1 } ` ,
112
- ] ,
112
+ domain : xAxisPoints ,
113
113
padding : 0.2 ,
114
114
} ) ;
115
115
// calculateMax
@@ -165,14 +165,17 @@ const BarGraphComparison = (props) => {
165
165
166
166
const handleChange = ( event ) => {
167
167
setSeries ( event . target . value ) ;
168
+ setXpoints ( ) ;
168
169
} ;
169
170
170
171
const handleClose = ( ) => {
171
172
setOpen ( false ) ;
173
+ setXpoints ( ) ;
172
174
} ;
173
175
174
176
const handleOpen = ( ) => {
175
177
setOpen ( true ) ;
178
+ setXpoints ( ) ;
176
179
} ;
177
180
178
181
const toStorage = {
@@ -181,20 +184,29 @@ const BarGraphComparison = (props) => {
181
184
data,
182
185
} ;
183
186
187
+ //manually assignin X -axis points with tab ID.
188
+ function setXpoints ( ) {
189
+ comparison [ series ] . data . barStack . forEach ( ( elem ) => {
190
+ elem . currentTab = 'comparison' ;
191
+ } ) ;
192
+ //comparison[series].data.barStack.currentTab = currentTab;
193
+ return comparison [ series ] . data . barStack ;
194
+ }
195
+
184
196
return (
185
197
< div >
186
- < div className = " series-options-container" >
187
- < div className = " snapshotId-header" >
198
+ < div className = ' series-options-container' >
199
+ < div className = ' snapshotId-header' >
188
200
{ ' ' }
189
201
Snapshot ID: { currentIndex + 1 } { ' ' }
190
202
</ div >
191
203
192
- < div className = " dropdown-and-save-series-container" >
193
- < FormControl variant = " outlined" className = { classes . formControl } >
204
+ < div className = ' dropdown-and-save-series-container' >
205
+ < FormControl variant = ' outlined' className = { classes . formControl } >
194
206
< Select
195
207
style = { { color : 'white' } }
196
- labelId = " simple-select-outlined-label"
197
- id = " simple-select-outlined"
208
+ labelId = ' simple-select-outlined-label'
209
+ id = ' simple-select-outlined'
198
210
className = { classes . select }
199
211
open = { open }
200
212
onClose = { handleClose }
@@ -215,7 +227,7 @@ const BarGraphComparison = (props) => {
215
227
</ FormControl >
216
228
217
229
< button
218
- className = " save-series-button"
230
+ className = ' save-series-button'
219
231
onClick = { ( ) => dispatch ( save ( toStorage ) ) }
220
232
>
221
233
Save Series
@@ -240,7 +252,7 @@ const BarGraphComparison = (props) => {
240
252
yScale = { renderingScale }
241
253
width = { xMax }
242
254
height = { yMax }
243
- stroke = " black"
255
+ stroke = ' black'
244
256
strokeOpacity = { 0.1 }
245
257
xOffset = { snapshotIdScale . bandwidth ( ) / 2 }
246
258
/>
@@ -257,11 +269,10 @@ const BarGraphComparison = (props) => {
257
269
{ ( barStacks ) =>
258
270
barStacks . map ( ( barStack , idx ) => {
259
271
const bar = barStack . bars [ currentIndex ] ;
260
-
261
272
return (
262
273
< rect
263
274
key = { `bar-stack-${ idx } -NewView` }
264
- x = { bar . x + 30 }
275
+ x = { bar . x }
265
276
y = { bar . y }
266
277
height = { bar . height === 0 ? null : bar . height }
267
278
width = { bar . width }
@@ -295,9 +306,9 @@ const BarGraphComparison = (props) => {
295
306
</ BarStack >
296
307
< BarStack
297
308
// Comparison Barstack
298
- data = { ! comparison [ series ] ? [ ] : comparison [ series ] . data . barStack }
309
+ data = { ! comparison [ series ] ? [ ] : setXpoints ( ) }
299
310
keys = { keys }
300
- x = { getSnapshotId }
311
+ x = { getTabID }
301
312
xScale = { snapshotIdScale }
302
313
yScale = { renderingScale }
303
314
color = { colorScale }
@@ -308,11 +319,10 @@ const BarGraphComparison = (props) => {
308
319
return < h1 > No Comparison</ h1 > ;
309
320
}
310
321
const bar = barStack . bars [ currentIndex ] ;
311
-
312
322
return (
313
323
< rect
314
324
key = { `bar-stack-${ idx } -${ bar . index } ` }
315
- x = { 225 }
325
+ x = { bar . x }
316
326
y = { bar . y }
317
327
height = { bar . height === 0 ? null : bar . height }
318
328
width = { bar . width }
@@ -374,14 +384,14 @@ const BarGraphComparison = (props) => {
374
384
/>
375
385
< Text
376
386
x = { - xMax / 2 }
377
- y = "15"
378
- transform = " rotate(-90)"
387
+ y = '15'
388
+ transform = ' rotate(-90)'
379
389
fontSize = { 12 }
380
- fill = " #FFFFFF"
390
+ fill = ' #FFFFFF'
381
391
>
382
392
Rendering Time (ms)
383
393
</ Text >
384
- < Text x = { xMax / 2 } y = { yMax + 65 } fontSize = { 12 } fill = " #FFFFFF" >
394
+ < Text x = { xMax / 2 } y = { yMax + 65 } fontSize = { 12 } fill = ' #FFFFFF' >
385
395
Series ID
386
396
</ Text >
387
397
</ svg >
0 commit comments