@@ -124,7 +124,7 @@ function GraphD3(_selector: HTMLDivElement, _options: any) {
124
124
if ( typeof options . onLabelNode === 'function' ) {
125
125
label = options . onLabelNode ( d ) ;
126
126
} else {
127
- label = d . properties ?. name || ( d . labels ? d . labels [ 0 ] : '' ) ;
127
+ label = d . properties ?. name || ( d . labels ?. length ? d . labels [ 0 ] : '' ) ;
128
128
}
129
129
let maxLength = ( maxTextSize - textSize ) + 3 ;
130
130
return label . length > maxLength ? Utils . truncateText ( label , maxLength ) : label ;
@@ -241,7 +241,7 @@ function GraphD3(_selector: HTMLDivElement, _options: any) {
241
241
return node . enter ( )
242
242
. append ( 'g' )
243
243
. attr ( 'class' , ( d ) => {
244
- const label = d . labels [ 0 ] ;
244
+ const label = d . labels ?. length ? d . labels [ 0 ] : '' ;
245
245
let classes = 'node' ;
246
246
let highlight ;
247
247
@@ -303,16 +303,17 @@ function GraphD3(_selector: HTMLDivElement, _options: any) {
303
303
304
304
function appendRingToNode ( svgNode ) {
305
305
return svgNode . append ( 'circle' )
306
- . attr ( 'class' , 'ring' )
307
- . attr ( 'r' , options . nodeRadius * 1.16 ) ;
306
+ . attr ( 'class' , 'ring' )
307
+ . style ( 'stroke' , ( d ) => labelColors ( d . labels ?. length ? d . labels [ 0 ] : '' ) . borderColor )
308
+ . attr ( 'r' , options . nodeRadius * 1.16 ) ;
308
309
}
309
310
310
311
function appendOutlineToNode ( svgNode ) {
311
312
return svgNode . append ( 'circle' )
312
313
. attr ( 'class' , 'outline' )
313
314
. attr ( 'r' , options . nodeRadius )
314
- . style ( 'fill' , ( d ) => labelColors ( d . labels [ 0 ] ) . color )
315
- . style ( 'stroke' , ( d ) => labelColors ( d . labels [ 0 ] ) . borderColor ) ;
315
+ . style ( 'fill' , ( d ) => labelColors ( d . labels ?. length ? d . labels [ 0 ] : '' ) . color )
316
+ . style ( 'stroke' , ( d ) => labelColors ( d . labels ?. length ? d . labels [ 0 ] : '' ) . borderColor ) ;
316
317
}
317
318
318
319
function appendNodeInfo ( svgNode ) {
@@ -353,15 +354,15 @@ function GraphD3(_selector: HTMLDivElement, _options: any) {
353
354
if ( typeof options . onLabelNode === 'function' ) {
354
355
label = options . onLabelNode ( d ) ;
355
356
} else {
356
- label = d . properties ?. name || ( d . labels ? d . labels [ 0 ] : '' ) ;
357
+ label = d . properties ?. name || ( d . labels ?. length ? d . labels [ 0 ] : '' ) ;
357
358
}
358
359
359
360
let maxLength = maxTextSize - nominalTextSize - 5 ;
360
361
return label . length > maxLength ? Utils . truncateText ( label , maxLength ) : label ;
361
362
} )
362
363
. attr ( 'class' , 'text' )
363
364
. attr ( 'font-size' , ( d ) => nominalTextSize + "px" )
364
- . attr ( 'fill' , ( d ) => labelColors ( d . labels [ 0 ] ) . textColor )
365
+ . attr ( 'fill' , ( d ) => labelColors ( d . labels ?. length ? d . labels [ 0 ] : '' ) . textColor )
365
366
. attr ( 'pointer-events' , 'none' )
366
367
. attr ( 'text-anchor' , 'middle' )
367
368
. attr ( 'dy' , ( ) => options . nodeRadius / ( ( options . nodeRadius * 25 ) / 100 ) ) ;
@@ -408,7 +409,8 @@ function GraphD3(_selector: HTMLDivElement, _options: any) {
408
409
409
410
function appendOverlayToRelationship ( r ) {
410
411
return r . append ( 'path' )
411
- . attr ( 'class' , 'overlay' ) ;
412
+ . attr ( 'class' , 'overlay' )
413
+ . style ( 'fill' , ( d ) => edgeColors ( d . type ) . color )
412
414
}
413
415
414
416
function appendTextToRelationship ( r ) {
0 commit comments