Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40b73e9

Browse files
author
Sebastian Wojtowicz
committed
[TASK] add possibility to attach data in moreInfo in sankey links and node
changes in src files now
1 parent 8a76d6e commit 40b73e9

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/traces/sankey/attributes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ var attrs = module.exports = overrideAll({
181181
description: 'Variables `sourceLinks` and `targetLinks` are arrays of link objects.',
182182
keys: ['value', 'label']
183183
}),
184+
moreInfo: {
185+
valType: 'data_array',
186+
dflt: [],
187+
},
184188
description: 'The nodes of the Sankey plot.'
185189
},
186190

@@ -255,6 +259,10 @@ var attrs = module.exports = overrideAll({
255259
description: 'Variables `source` and `target` are node objects.',
256260
keys: ['value', 'label']
257261
}),
262+
moreInfo: {
263+
valType: 'data_array',
264+
dflt: [],
265+
},
258266
colorscales: templatedArray('concentrationscales', {
259267
editType: 'calc',
260268
label: {

src/traces/sankey/defaults.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
4242
coerceNode('hoverinfo', traceIn.hoverinfo);
4343
handleHoverLabelDefaults(nodeIn, nodeOut, coerceNode, hoverlabelDefault);
4444
coerceNode('hovertemplate');
45+
coerceNode('moreInfo');
4546

4647
var colors = layout.colorway;
4748

@@ -67,6 +68,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
6768
coerceLink('hoverinfo', traceIn.hoverinfo);
6869
handleHoverLabelDefaults(linkIn, linkOut, coerceLink, hoverlabelDefault);
6970
coerceLink('hovertemplate');
71+
coerceLink('moreInfo');
7072

7173
var defaultLinkColor = tinycolor(layout.paper_bgcolor).getLuminance() < 0.333 ?
7274
'rgba(255, 255, 255, 0.6)' :

src/traces/sankey/render.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ function linkModel(d, l, i) {
296296
// for event data
297297
l.trace = d.trace;
298298
l.curveNumber = d.trace.index;
299+
l.moreInfo = d.trace.link.moreInfo[i];
299300

300301
return {
301302
circular: d.circular,
@@ -483,6 +484,7 @@ function nodeModel(d, n) {
483484
// for event data
484485
n.trace = d.trace;
485486
n.curveNumber = d.trace.index;
487+
n.moreInfo = d.trace.node.moreInfo[n.pointNumber];
486488

487489
return {
488490
index: n.pointNumber,

0 commit comments

Comments
 (0)