@@ -48,7 +48,7 @@ interface TooltipData {
4848const margin = {
4949 top : 30 , right : 30 , bottom : 0 , left : 50 ,
5050} ;
51- const axisColor = '#62d6fb ' ;
51+ const axisColor = '#FF6569 ' ;
5252const background = '#242529' ;
5353const tooltipStyles = {
5454 ...defaultStyles ,
@@ -94,7 +94,7 @@ const BarGraph = props => {
9494 // }
9595 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)" ]
9696 for ( const [ key , value ] of Object . entries ( data . barStack [ 0 ] ) ) {
97- console . log ( i ) ;
97+ // console.log(i);
9898 console . log ( xMax , '<-- xmax' ) ;
9999 if ( key !== 'snapshotId' && key !== 'route' ) {
100100 console . log ( `${ key } : ${ value } ` ) ;
@@ -110,7 +110,7 @@ const BarGraph = props => {
110110 height = { value }
111111 key = { key }
112112 width = { barWidth }
113- fill = { '#ffffb3 ' }
113+ fill = { '#62d6fb ' }
114114 onMouseLeave = { ( ) => {
115115 dispatch (
116116 onHoverExit ( data . componentData [ key ] . rtid ) ,
@@ -145,7 +145,7 @@ const BarGraph = props => {
145145 height = { value * 20 }
146146 key = { key }
147147 width = { barWidth }
148- fill = { '#ffffb3 ' }
148+ fill = { '#62d6fb ' }
149149 onMouseLeave = { ( ) => {
150150 dispatch (
151151 onHoverExit ( data . componentData [ key ] . rtid ) ,
@@ -202,14 +202,26 @@ const BarGraph = props => {
202202 padding : 0.2 ,
203203 } ) ;
204204
205+ console . log ( data , ' <--data' )
206+ console . log ( data . maxTotalRender , ' <--data.maxTotalRender' )
207+
205208 const renderingScale = scaleLinear < number > ( {
206209 domain : [ 0 , data . maxTotalRender ] ,
207210 nice : true ,
208211 } ) ;
209212
210- // const componentScale = scaleBand<string>({
211- // domain: placeholder
212- // })
213+ const componentsKeys = [ ] ;
214+ for ( let key in data . barStack [ 0 ] ) {
215+ if ( key !== 'route' && key !== 'snapshotId' )
216+ componentsKeys . push ( key ) ;
217+ }
218+ console . log ( data . barStack . map ( getSnapshotId ) , '<-- check if getSnapshotId matches componentKeys' )
219+ console . log ( componentsKeys , '<-- componentKeys' )
220+
221+ const componentScale = scaleBand < string > ( {
222+ domain : componentsKeys ,
223+ padding : 0.2
224+ } )
213225
214226 const colorScale = scaleOrdinal < string > ( {
215227 domain : keys ,
@@ -222,6 +234,8 @@ const BarGraph = props => {
222234 snapshotIdScale . rangeRound ( [ 0 , xMax ] ) ;
223235 renderingScale . range ( [ yMax , 0 ] ) ;
224236
237+ componentScale . rangeRound ( [ 0 , xMax ] ) ;
238+
225239 const toStorage = {
226240 currentTab,
227241 title : tabs [ currentTab ] . title ,
@@ -325,7 +339,8 @@ const BarGraph = props => {
325339 height = { yMax }
326340 stroke = "black"
327341 strokeOpacity = { 0.1 }
328- xOffset = { snapshotIdScale . bandwidth ( ) / 2 } />
342+ xOffset = { snapshotIdScale . bandwidth ( ) / 2 }
343+ />
329344 < Group top = { margin . top } left = { margin . left } >
330345 < BarStack
331346 data = { data . barStack }
@@ -381,68 +396,113 @@ const BarGraph = props => {
381396 ) ;
382397 } ) ) }
383398 </ BarStack >
384- </ Group > </ >
399+ </ Group >
400+ < AxisLeft
401+ top = { margin . top }
402+ left = { margin . left }
403+ scale = { renderingScale }
404+ stroke = { axisColor }
405+ tickStroke = { axisColor }
406+ strokeWidth = { 2 }
407+ tickLabelProps = { ( ) => ( {
408+ fill : 'rgb(231, 231, 231)' ,
409+ fontSize : 11 ,
410+ verticalAnchor : 'middle' ,
411+ textAnchor : 'end' ,
412+ } ) }
413+ />
414+ < AxisBottom
415+ top = { yMax + margin . top }
416+ left = { margin . left }
417+ scale = { snapshotIdScale }
418+ stroke = { axisColor }
419+ tickStroke = { axisColor }
420+ strokeWidth = { 2 }
421+ tickLabelProps = { ( ) => ( {
422+ fill : 'rgb(231, 231, 231)' ,
423+ fontSize : 11 ,
424+ textAnchor : 'middle' ,
425+ } ) }
426+ />
427+ < Text
428+ x = { - xMax / 2 }
429+ y = "15"
430+ transform = "rotate(-90)"
431+ fontSize = { 12 }
432+ fill = "#FFFFFF"
433+ >
434+ Rendering Time (ms)
435+ </ Text >
436+ < br />
437+ < Text x = { xMax / 2 + 15 } y = { yMax + 70 } fontSize = { 12 } fill = "#FFFFFF" >
438+ Snapshot ID
439+ </ Text >
440+ </ >
385441 )
386442 : (
387443 < >
388- { snapshotIdScale . rangeRound ( [ 0 , xMax ] ) }
389444 < Grid
390445 top = { margin . top }
391446 left = { margin . left }
392- xScale = { snapshotIdScale }
447+ // xScale={snapshotIdScale}
448+ xScale = { componentScale }
393449 yScale = { renderingScale }
394450 width = { xMax }
395451 height = { yMax }
396452 stroke = "black"
397453 strokeOpacity = { 0.1 }
398- xOffset = { snapshotIdScale . bandwidth ( ) / 2 }
454+ xOffset = { componentScale . bandwidth ( ) / 2 }
399455 />
400456 < Group top = { margin . top } left = { margin . left } >
401457 { HorizontalGraph ( ) }
402- </ Group > </ >
458+ </ Group >
459+ < AxisLeft
460+ top = { margin . top }
461+ left = { margin . left }
462+ scale = { renderingScale }
463+ stroke = { axisColor }
464+ tickStroke = { axisColor }
465+ strokeWidth = { 2 }
466+ tickLabelProps = { ( ) => ( {
467+ fill : 'rgb(231, 231, 231)' ,
468+ fontSize : 11 ,
469+ verticalAnchor : 'middle' ,
470+ textAnchor : 'end' ,
471+ } ) }
472+ />
473+ < AxisBottom
474+ top = { yMax + margin . top }
475+ left = { margin . left }
476+ scale = { componentScale }
477+ stroke = { axisColor }
478+ tickStroke = { axisColor }
479+ strokeWidth = { 2 }
480+ tickLabelProps = { ( ) => ( {
481+ fill : 'rgb(231, 231, 231)' ,
482+ fontSize : 11 ,
483+ textAnchor : 'middle' ,
484+ } ) }
485+ />
486+ < Text
487+ // x={-xMax / 2}
488+ // x={Math.max((-xMax / 2), (-yMax / 2))}
489+ x = { - yMax / 2 - 75 }
490+ y = "15"
491+ transform = "rotate(-90)"
492+ fontSize = { 12 }
493+ fill = "#FFFFFF"
494+ >
495+ Rendering Time (ms)
496+ </ Text >
497+ < br />
498+ < Text x = { xMax / 2 + 15 } y = { yMax + 70 } fontSize = { 12 } fill = "#FFFFFF" >
499+ Snapshot ID
500+ </ Text >
501+ </ >
403502 )
404503 }
405504
406- < AxisLeft
407- top = { margin . top }
408- left = { margin . left }
409- scale = { renderingScale }
410- stroke = { axisColor }
411- tickStroke = { axisColor }
412- strokeWidth = { 2 }
413- tickLabelProps = { ( ) => ( {
414- fill : 'rgb(231, 231, 231)' ,
415- fontSize : 11 ,
416- verticalAnchor : 'middle' ,
417- textAnchor : 'end' ,
418- } ) }
419- />
420- < AxisBottom
421- top = { yMax + margin . top }
422- left = { margin . left }
423- scale = { snapshotIdScale }
424- stroke = { axisColor }
425- tickStroke = { axisColor }
426- strokeWidth = { 2 }
427- tickLabelProps = { ( ) => ( {
428- fill : 'rgb(231, 231, 231)' ,
429- fontSize : 11 ,
430- textAnchor : 'middle' ,
431- } ) }
432- />
433- < Text
434- x = { - xMax / 2 }
435- y = "15"
436- transform = "rotate(-90)"
437- fontSize = { 12 }
438- fill = "#FFFFFF"
439- >
440- Rendering Time (ms)
441- </ Text >
442- < br />
443- < Text x = { xMax / 2 + 15 } y = { yMax + 70 } fontSize = { 12 } fill = "#FFFFFF" >
444- Snapshot ID
445- </ Text >
505+
446506 </ svg >
447507 { /* FOR HOVER OVER DISPLAY */ }
448508 { tooltipOpen && tooltipData && (
0 commit comments