@@ -103,6 +103,7 @@ const BarGraph = props => {
103
103
// }
104
104
const rgb = [ 'rgba(50, 100, 241, .5)' , 'rgba(90, 150, 217, .5)' , 'rgba(200, 30, 7, .5)' , 'rgba(23, 233, 217, .5)' , 'rgba(150, 227, 19, .5)' ] ;
105
105
for ( const [ key , value ] of Object . entries ( data . barStack [ 0 ] ) ) {
106
+ const toolTipData = { key : key , value : value }
106
107
console . log ( xMax , '<-- xmax' ) ;
107
108
if ( key !== 'snapshotId' && key !== 'route' ) {
108
109
// console.log(`${key}: ${value}`);
@@ -135,7 +136,7 @@ const BarGraph = props => {
135
136
const top = event . clientY - margin . top - value * 25 ;
136
137
const left = 10 + 10 * i + barWidth * i + barWidth / 2 ;
137
138
showTooltip ( {
138
- tooltipData : value ,
139
+ tooltipData : toolTipData ,
139
140
tooltipTop : top ,
140
141
tooltipLeft : left ,
141
142
} ) ;
@@ -169,7 +170,7 @@ const BarGraph = props => {
169
170
const top = event . clientY - margin . top - value * 25 ;
170
171
const left = 10 + 10 * i + barWidth * i + barWidth / 2 ;
171
172
showTooltip ( {
172
- tooltipData : value ,
173
+ tooltipData : toolTipData ,
173
174
tooltipTop : top ,
174
175
tooltipLeft : left ,
175
176
} ) ;
@@ -511,7 +512,10 @@ const BarGraph = props => {
511
512
512
513
</ svg >
513
514
{ /* FOR HOVER OVER DISPLAY */ }
514
- { tooltipOpen && tooltipData && (
515
+ { /* Ths conditional statement displays a different tooltip
516
+ configuration depending on if we are trying do display a specific
517
+ snapshot through options menu or all snapshots together in bargraph */ }
518
+ { snapshot === 'All Snapshots' ? ( tooltipOpen && tooltipData && (
515
519
< TooltipInPortal
516
520
key = { Math . random ( ) } // update tooltip bounds each render
517
521
top = { tooltipTop }
@@ -536,7 +540,30 @@ const BarGraph = props => {
536
540
</ small >
537
541
</ div >
538
542
</ TooltipInPortal >
539
- ) }
543
+ ) )
544
+ : ( tooltipOpen && tooltipData && (
545
+ < TooltipInPortal
546
+ key = { Math . random ( ) } // update tooltip bounds each render
547
+ top = { tooltipTop }
548
+ left = { tooltipLeft }
549
+ style = { tooltipStyles }
550
+ >
551
+ { console . log ( tooltipData , '<------tooltipData' ) }
552
+ < div style = { { color : colorScale ( tooltipData . key ) } } >
553
+ { ' ' }
554
+ < strong > { tooltipData . key } </ strong >
555
+ { ' ' }
556
+ </ div >
557
+ < div >
558
+ { ' ' }
559
+ { formatRenderTime ( tooltipData . value ) }
560
+ { ' ' }
561
+ </ div >
562
+ < div >
563
+ { ' ' }
564
+ </ div >
565
+ </ TooltipInPortal >
566
+ ) ) }
540
567
</ div >
541
568
) ;
542
569
} ;
0 commit comments