@@ -20,8 +20,8 @@ This side effect is only seen in recoil apps...
20
20
*/
21
21
22
22
/* TYPESCRIPT */
23
+ type margin = { top : number ; right : number ; bottom : number ; left : number } ;
23
24
type snapshot = any ;
24
-
25
25
type TooltipData = {
26
26
bar : SeriesPoint < snapshot > ;
27
27
key : CityName ;
@@ -37,16 +37,14 @@ type TooltipData = {
37
37
type BarStackProps = {
38
38
width : number ;
39
39
height : number ;
40
- margin ?: { top : number ; right : number ; bottom : number ; left : number } ;
41
- events ?: boolean ;
42
- snapshots ?: any ;
43
- hierarchy ?: any ;
40
+ snapshots : [ ] ;
41
+ hierarchy : any ;
44
42
} ;
45
43
44
+
45
+
46
46
/* DEFAULTS */
47
- const defaultMargin = {
48
- top : 60 , right : 30 , bottom : 0 , left : 50 ,
49
- } ;
47
+ const margin = { top : 60 , right : 30 , bottom : 0 , left : 50 } ;
50
48
const axisColor = '#679DCA' ;
51
49
const background = '#242529' ;
52
50
const tooltipStyles = {
@@ -92,14 +90,11 @@ const getSnapshotIds = (obj, snapshotIds = []) => {
92
90
} ;
93
91
94
92
/* EXPORT COMPONENT */
95
- export default function PerformanceVisx ( {
96
- width,
97
- height,
98
- events = false ,
99
- margin = defaultMargin ,
100
- snapshots,
101
- hierarchy,
102
- } : BarStackProps ) {
93
+
94
+ const PerformanceVisx = ( props : BarStackProps ) => {
95
+
96
+ const { width, height, snapshots, hierarchy } = props ;
97
+
103
98
const {
104
99
tooltipOpen,
105
100
tooltipLeft,
@@ -118,6 +113,10 @@ export default function PerformanceVisx({
118
113
const keys = Object . keys ( data [ 0 ] ) . filter ( d => d !== 'snapshotId' ) as CityName [ ] ;
119
114
const allComponentStates = traverse ( snapshots [ 0 ] ) ;
120
115
116
+ console . log ( snapshots ) ;
117
+ console . log ( hierarchy ) ;
118
+ console . log ( 'margin' , margin ) ;
119
+
121
120
// create array of total render times for each snapshot
122
121
const totalRenderArr = data . reduce ( ( totalRender , curSnapshot ) => {
123
122
const curRenderTotal = keys . reduce ( ( acc , cur ) => {
@@ -156,8 +155,8 @@ export default function PerformanceVisx({
156
155
snapshotIdScale . rangeRound ( [ 0 , xMax ] ) ;
157
156
renderingScale . range ( [ yMax , 0 ] ) ;
158
157
158
+ // if performance tab is too small it will not return VISX component
159
159
return width < 10 ? null : (
160
- // relative position is needed for correct tooltip positioning
161
160
162
161
< div style = { { position : 'relative' } } >
163
162
< svg ref = { containerRef } width = { width } height = { height } >
@@ -277,4 +276,6 @@ export default function PerformanceVisx({
277
276
) }
278
277
</ div >
279
278
) ;
280
- }
279
+ } ;
280
+
281
+ export default PerformanceVisx ;
0 commit comments