@@ -70,11 +70,14 @@ const BarGraphComparison = (props) => {
70
70
const [ { tabs, currentTab } , dispatch ] = useStoreContext ( ) ;
71
71
const { width, height, data, comparison } = props ;
72
72
const [ series , setSeries ] = React . useState ( 0 ) ;
73
+ const [ snapshots , setSnapshots ] = React . useState ( 0 ) ;
73
74
const [ open , setOpen ] = React . useState ( false ) ;
75
+ const [ picOpen , setPicOpen ] = React . useState ( false ) ;
74
76
const [ maxRender , setMaxRender ] = React . useState ( data . maxTotalRender ) ;
77
+ console . log ( 'comparison:' , comparison )
78
+ console . log ( 'tabs:' , tabs )
75
79
76
80
function titleFilter ( comparisonArray ) {
77
- console . log ( "titleFilter comparison array" , comparisonArray )
78
81
return comparisonArray . filter (
79
82
( elem ) => elem . title . split ( '-' ) [ 1 ] === tabs [ currentTab ] . title . split ( '-' ) [ 1 ]
80
83
) ;
@@ -93,6 +96,7 @@ const BarGraphComparison = (props) => {
93
96
let tooltipTimeout : number ;
94
97
95
98
const { containerRef, TooltipInPortal } = useTooltipInPortal ( ) ;
99
+ console . log ( "containerRef" , containerRef )
96
100
97
101
const keys = Object . keys ( data . componentData ) ;
98
102
@@ -101,6 +105,8 @@ const BarGraphComparison = (props) => {
101
105
const formatSnapshotId = ( id ) => `Snapshot ID: ${ id } ` ;
102
106
const formatRenderTime = ( time ) => `${ time } ms ` ;
103
107
const getCurrentTab = ( storedSeries ) => storedSeries . currentTab ;
108
+
109
+
104
110
// create visualization SCALES with cleaned data
105
111
// the domain array/xAxisPoints elements will place the bars along the x-axis
106
112
const xAxisPoints = [ 'currentTab' , 'comparison' ] ;
@@ -184,18 +190,36 @@ const BarGraphComparison = (props) => {
184
190
// setXpoints();
185
191
} ;
186
192
193
+ const picHandleChange = ( event ) => {
194
+ console . log ( 'setsnapshot to' , ( event . target . value + 1 ) . toString ( ) + ".0" )
195
+ setSnapshots ( ( event . target . value + 1 ) . toString ( ) + ".0" ) ;
196
+ // setXpoints();
197
+ } ;
198
+
199
+ const picHandleClose = ( ) => {
200
+ setPicOpen ( false ) ;
201
+ // setXpoints();
202
+ } ;
203
+
204
+ const picHandleOpen = ( ) => {
205
+ setPicOpen ( true ) ;
206
+ // setXpoints();
207
+ } ;
208
+
187
209
//manually assignin X -axis points with tab ID.
188
210
function setXpointsComparison ( ) {
189
211
comparison [ series ] . data . barStack . forEach ( ( elem ) => {
190
212
elem . currentTab = 'comparison' ;
191
213
} ) ;
192
214
//comparison[series].data.barStack.currentTab = currentTab;
215
+ console . log ( "setXpointsComparison/comparison[series].data.barStack:" , comparison [ series ] . data . barStack )
193
216
return comparison [ series ] . data . barStack ;
194
217
}
195
218
function setXpointsCurrentTab ( ) {
196
219
data . barStack . forEach ( ( element ) => {
197
220
element . currentTab = 'currentTab' ;
198
221
} ) ;
222
+ console . log ( "setXpointsCurrentTan/data.barStack:" , data . barStack )
199
223
return data . barStack ;
200
224
}
201
225
const animateButton = function ( e ) {
@@ -214,10 +238,7 @@ const BarGraphComparison = (props) => {
214
238
return (
215
239
< div >
216
240
< div className = "series-options-container" >
217
- < div className = "snapshotId-header" >
218
- { ' ' }
219
- Snapshot ID: { currentIndex + 1 } { ' ' }
220
- </ div >
241
+
221
242
222
243
< div className = "dropdown-and-delete-series-container" >
223
244
< button
@@ -228,7 +249,7 @@ const BarGraphComparison = (props) => {
228
249
>
229
250
Clear All Series
230
251
</ button >
231
- < h4 style = { { padding : '0 1rem' } } > Compare with : </ h4 >
252
+ < h4 style = { { padding : '0 1rem' } } > Comparison Series : </ h4 >
232
253
< FormControl variant = "outlined" className = { classes . formControl } >
233
254
< Select
234
255
style = { { color : 'white' } }
@@ -246,7 +267,31 @@ const BarGraphComparison = (props) => {
246
267
) : (
247
268
titleFilter ( comparison ) . map ( ( tabElem , index ) => {
248
269
return (
249
- < MenuItem value = { index } > { `Series ${ index + 1 } ` } </ MenuItem >
270
+ < MenuItem value = { index } > { `${ currentTab } ${ index + 1 } ` } </ MenuItem >
271
+ ) ;
272
+ } )
273
+ ) }
274
+ </ Select >
275
+ </ FormControl >
276
+ < h4 style = { { padding : '0 1rem' } } > Comparator Snapshot? </ h4 >
277
+ < FormControl variant = "outlined" className = { classes . formControl } >
278
+ < Select
279
+ style = { { color : 'white' } }
280
+ labelId = "snapshot-select"
281
+ id = "snapshot-select"
282
+ className = { classes . select }
283
+ open = { picOpen }
284
+ onClose = { picHandleClose }
285
+ onOpen = { picHandleOpen }
286
+ value = { snapshots } //snapshots
287
+ onChange = { picHandleChange }
288
+ >
289
+ { ! comparison [ snapshots ] ? (
290
+ < MenuItem > No snapshots available</ MenuItem >
291
+ ) : (
292
+ titleFilter ( comparison ) . map ( ( tabElem , index ) => {
293
+ return (
294
+ < MenuItem value = { index } > { `${ index + 1 } ` } </ MenuItem >
250
295
) ;
251
296
} )
252
297
) }
0 commit comments