@@ -20,6 +20,10 @@ interface IExplain {
20
20
data : [ { response : string [ ] | string | any } ]
21
21
}
22
22
23
+ function getEdgeSize ( c : number ) {
24
+ return ( Math . log ( c || 1 ) / Math . log ( 3 ) ) + 1
25
+ }
26
+
23
27
export default function Explain ( props : IExplain ) : JSX . Element {
24
28
const command = props . command . split ( ' ' ) [ 0 ] . toLowerCase ( )
25
29
@@ -139,8 +143,12 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
139
143
ancestors . pairs . forEach ( p => {
140
144
const parentNode = document . querySelector ( `#node-${ p [ 0 ] } ` )
141
145
parentNode ?. classList . add ( 'ProfileContainerHover' )
142
- document . querySelector ( `[data-cell-id='${ p [ 0 ] } -${ p [ 1 ] } ']` ) ?. childNodes . forEach ( k => {
143
- ( k as any ) . setAttribute ( "style" , "stroke: #85A2FE; stroke-linecap: butt; stroke-width: 2px" )
146
+ document . querySelector ( `[data-cell-id='${ p [ 0 ] } -${ p [ 1 ] } ']` ) ?. childNodes . forEach ( ( k : any ) => {
147
+
148
+ const entityNode = document . querySelector ( `#node-${ p [ 1 ] } ` ) as any
149
+
150
+ const strokeSize = getEdgeSize ( parseInt ( entityNode ?. dataset ?. size ) ) + 1 ;
151
+ k . setAttribute ( "style" , `stroke: #85A2FE; stroke-linecap: butt; stroke-width: ${ strokeSize } px` )
144
152
} )
145
153
} )
146
154
}
@@ -205,7 +213,6 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
205
213
info . recordsProduced = info . counter
206
214
delete info . counter
207
215
delete info . size
208
-
209
216
}
210
217
211
218
let nodeProps = {
@@ -238,6 +245,8 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
238
245
}
239
246
if ( data . children ) {
240
247
data . children . forEach ( ( item : any ) => {
248
+ const itemRecords = parseInt ( item . data . counter || 0 )
249
+
241
250
model . edges ?. push ( {
242
251
id : `${ data . id } -${ item . id } ` ,
243
252
source : data . id ,
@@ -260,7 +269,7 @@ function ExplainDraw({data, type, module, profilingTime}: {data: any, type: Core
260
269
attrs : {
261
270
line : {
262
271
stroke : isDarkTheme ? '#6B6B6B' : '#8992B3' ,
263
- strokeWidth : 1 ,
272
+ strokeWidth : getEdgeSize ( itemRecords ) ,
264
273
targetMarker : null ,
265
274
} ,
266
275
} ,
0 commit comments