@@ -48,7 +48,7 @@ interface TooltipData {
48
48
const margin = {
49
49
top : 30 , right : 30 , bottom : 0 , left : 50 ,
50
50
} ;
51
- const axisColor = '#62d6fb ' ;
51
+ const axisColor = '#FF6569 ' ;
52
52
const background = '#242529' ;
53
53
const tooltipStyles = {
54
54
...defaultStyles ,
@@ -94,7 +94,7 @@ const BarGraph = props => {
94
94
// }
95
95
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)" ]
96
96
for ( const [ key , value ] of Object . entries ( data . barStack [ 0 ] ) ) {
97
- console . log ( i ) ;
97
+ // console.log(i);
98
98
console . log ( xMax , '<-- xmax' ) ;
99
99
if ( key !== 'snapshotId' && key !== 'route' ) {
100
100
console . log ( `${ key } : ${ value } ` ) ;
@@ -110,7 +110,7 @@ const BarGraph = props => {
110
110
height = { value }
111
111
key = { key }
112
112
width = { barWidth }
113
- fill = { '#ffffb3 ' }
113
+ fill = { '#62d6fb ' }
114
114
onMouseLeave = { ( ) => {
115
115
dispatch (
116
116
onHoverExit ( data . componentData [ key ] . rtid ) ,
@@ -145,7 +145,7 @@ const BarGraph = props => {
145
145
height = { value * 20 }
146
146
key = { key }
147
147
width = { barWidth }
148
- fill = { '#ffffb3 ' }
148
+ fill = { '#62d6fb ' }
149
149
onMouseLeave = { ( ) => {
150
150
dispatch (
151
151
onHoverExit ( data . componentData [ key ] . rtid ) ,
@@ -202,14 +202,26 @@ const BarGraph = props => {
202
202
padding : 0.2 ,
203
203
} ) ;
204
204
205
+ console . log ( data , ' <--data' )
206
+ console . log ( data . maxTotalRender , ' <--data.maxTotalRender' )
207
+
205
208
const renderingScale = scaleLinear < number > ( {
206
209
domain : [ 0 , data . maxTotalRender ] ,
207
210
nice : true ,
208
211
} ) ;
209
212
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
+ } )
213
225
214
226
const colorScale = scaleOrdinal < string > ( {
215
227
domain : keys ,
@@ -222,6 +234,8 @@ const BarGraph = props => {
222
234
snapshotIdScale . rangeRound ( [ 0 , xMax ] ) ;
223
235
renderingScale . range ( [ yMax , 0 ] ) ;
224
236
237
+ componentScale . rangeRound ( [ 0 , xMax ] ) ;
238
+
225
239
const toStorage = {
226
240
currentTab,
227
241
title : tabs [ currentTab ] . title ,
@@ -325,7 +339,8 @@ const BarGraph = props => {
325
339
height = { yMax }
326
340
stroke = "black"
327
341
strokeOpacity = { 0.1 }
328
- xOffset = { snapshotIdScale . bandwidth ( ) / 2 } />
342
+ xOffset = { snapshotIdScale . bandwidth ( ) / 2 }
343
+ />
329
344
< Group top = { margin . top } left = { margin . left } >
330
345
< BarStack
331
346
data = { data . barStack }
@@ -381,68 +396,113 @@ const BarGraph = props => {
381
396
) ;
382
397
} ) ) }
383
398
</ 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
+ </ >
385
441
)
386
442
: (
387
443
< >
388
- { snapshotIdScale . rangeRound ( [ 0 , xMax ] ) }
389
444
< Grid
390
445
top = { margin . top }
391
446
left = { margin . left }
392
- xScale = { snapshotIdScale }
447
+ // xScale={snapshotIdScale}
448
+ xScale = { componentScale }
393
449
yScale = { renderingScale }
394
450
width = { xMax }
395
451
height = { yMax }
396
452
stroke = "black"
397
453
strokeOpacity = { 0.1 }
398
- xOffset = { snapshotIdScale . bandwidth ( ) / 2 }
454
+ xOffset = { componentScale . bandwidth ( ) / 2 }
399
455
/>
400
456
< Group top = { margin . top } left = { margin . left } >
401
457
{ 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
+ </ >
403
502
)
404
503
}
405
504
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
+
446
506
</ svg >
447
507
{ /* FOR HOVER OVER DISPLAY */ }
448
508
{ tooltipOpen && tooltipData && (
0 commit comments