@@ -74,8 +74,10 @@ function sankeyModel(layout, d, i) {
7474 horizontal = trace . orientation === 'h' ,
7575 nodePad = trace . node . pad ,
7676 nodeThickness = trace . node . thickness ,
77- nodelineColor = trace . node . line . color ,
78- nodelineWidth = trace . node . line . width ,
77+ nodeLineColor = trace . node . line . color ,
78+ nodeLineWidth = trace . node . line . width ,
79+ linkLineColor = trace . link . line . color ,
80+ linkLineWidth = trace . link . line . width ,
7981 valueFormat = trace . valueformat ,
8082 valueSuffix = trace . valuesuffix ,
8183 textFont = trace . textfont ;
@@ -126,8 +128,10 @@ function sankeyModel(layout, d, i) {
126128 width : width ,
127129 height : height ,
128130 nodePad : nodePad ,
129- nodelineColor : nodelineColor ,
130- nodelineWidth : nodelineWidth ,
131+ nodeLineColor : nodeLineColor ,
132+ nodeLineWidth : nodeLineWidth ,
133+ linkLineColor : linkLineColor ,
134+ linkLineWidth : linkLineWidth ,
131135 valueFormat : valueFormat ,
132136 valueSuffix : valueSuffix ,
133137 textFont : textFont ,
@@ -161,6 +165,8 @@ function linkModel(uniqueKeys, d, l) {
161165 link : l ,
162166 tinyColorHue : Color . tinyRGB ( tc ) ,
163167 tinyColorAlpha : tc . getAlpha ( ) ,
168+ linkLineColor : d . linkLineColor ,
169+ linkLineWidth : d . linkLineWidth ,
164170 valueFormat : d . valueFormat ,
165171 valueSuffix : d . valueSuffix ,
166172 sankey : d . sankey ,
@@ -188,8 +194,8 @@ function nodeModel(uniqueKeys, d, n) {
188194 traceId : d . key ,
189195 node : n ,
190196 nodePad : d . nodePad ,
191- nodelineColor : d . nodelineColor ,
192- nodelineWidth : d . nodelineWidth ,
197+ nodeLineColor : d . nodeLineColor ,
198+ nodeLineWidth : d . nodeLineWidth ,
193199 textFont : d . textFont ,
194200 size : d . horizontal ? d . height : d . width ,
195201 visibleWidth : Math . ceil ( d . horizontal ? visibleThickness : visibleLength ) ,
@@ -253,6 +259,10 @@ function sizeNode(rect) {
253259 . attr ( 'height' , function ( d ) { return d . visibleHeight ; } ) ;
254260}
255261
262+ function salientEnough ( d ) {
263+ return d . link . dy > 1 || d . linkLineWidth > 0 ;
264+ }
265+
256266function linksTransform ( d ) {
257267 return d . horizontal ? 'matrix(1,0,0,1,0,0)' : 'matrix(0,1,1,0,0,0)' ;
258268}
@@ -455,9 +465,13 @@ module.exports = function(svg, styledData, layout, callbacks) {
455465 . call ( attachPointerEvents , sankey , callbacks . linkEvents ) ;
456466
457467 sankeyLink
458- . style ( 'stroke' , function ( d ) { return d . link . dy > 1 ? 'rgba(0,0,0,0)' : d . tinyColorHue ; } )
459- . style ( 'stroke-width' , function ( d ) { return d . link . dy > 1 ? 2 : 1 ; } )
460- . style ( 'stroke-opacity' , function ( d ) { return d . tinyColorAlpha ; } )
468+ . style ( 'stroke' , function ( d ) {
469+ return salientEnough ( d ) ? Color . tinyRGB ( tinycolor ( d . linkLineColor ) ) : d . tinyColorHue ;
470+ } )
471+ . style ( 'stroke-opacity' , function ( d ) {
472+ return salientEnough ( d ) ? Color . opacity ( d . linkLineColor ) : d . tinyColorAlpha ;
473+ } )
474+ . style ( 'stroke-width' , function ( d ) { return salientEnough ( d ) ? d . linkLineWidth : 1 ; } )
461475 . style ( 'fill' , function ( d ) { return d . tinyColorHue ; } )
462476 . style ( 'fill-opacity' , function ( d ) { return d . tinyColorAlpha ; } ) ;
463477
@@ -524,9 +538,9 @@ module.exports = function(svg, styledData, layout, callbacks) {
524538 . call ( sizeNode ) ;
525539
526540 nodeRect
527- . style ( 'stroke-width' , function ( d ) { return d . nodelineWidth ; } )
528- . style ( 'stroke' , function ( d ) { return Color . tinyRGB ( tinycolor ( d . nodelineColor ) ) ; } )
529- . style ( 'stroke-opacity' , function ( d ) { return Color . opacity ( d . nodelineColor ) ; } )
541+ . style ( 'stroke-width' , function ( d ) { return d . nodeLineWidth ; } )
542+ . style ( 'stroke' , function ( d ) { return Color . tinyRGB ( tinycolor ( d . nodeLineColor ) ) ; } )
543+ . style ( 'stroke-opacity' , function ( d ) { return Color . opacity ( d . nodeLineColor ) ; } )
530544 . style ( 'fill' , function ( d ) { return d . tinyColorHue ; } )
531545 . style ( 'fill-opacity' , function ( d ) { return d . tinyColorAlpha ; } ) ;
532546
0 commit comments