Skip to content

Sankey feature branch #1591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
May 9, 2017
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1656c5b
squashed Sankey feature branch for 1st look
monfera Feb 22, 2017
e7892fe
PR feedback and other updates to Sankey
monfera Apr 13, 2017
65b2d57
fix up bundle files
monfera Apr 28, 2017
aa41f28
removed colorbar leftover
monfera Apr 28, 2017
dec701a
unit shown in attribute doc
monfera Apr 28, 2017
1fb7cbd
removed vestigial attribs
monfera May 1, 2017
426b50d
flipping attrib representation to columnar
monfera May 1, 2017
dab87ae
circularity detection
monfera May 1, 2017
fdf9849
Revert "removed colorbar leftover"
monfera May 1, 2017
62257b4
restore dist to what was before
monfera May 1, 2017
4ea240f
mock update
monfera May 1, 2017
4e98b12
working around image gen sensitivity
monfera May 1, 2017
747eb23
Alex's suggestion for checking self-links too
monfera May 1, 2017
1cbc2f2
attribute work:
monfera May 1, 2017
e69e3a2
attribute work:
monfera May 1, 2017
90c003a
having published our d3-sankey fork under the @plotly scope
monfera May 2, 2017
3d10714
using traceOut in defaults for downstream default generation
monfera May 2, 2017
a2a416e
jasmine tests for Sankey
monfera May 2, 2017
3e2a455
jasmine tests for Sankey - warning / error test (and defaults.js improv)
monfera May 2, 2017
b91aa25
default empty arrays in attributes.js
monfera May 2, 2017
223421e
warning message update (PR feedback, thanks Alex!)
monfera May 2, 2017
4c3521a
removed unused colorbar
monfera May 2, 2017
af1c43b
PR feedback: noOpacity; no need to add toSVG; no empty line after fun…
monfera May 9, 2017
9214c92
PR feedback: moved circularity check into calc.js
monfera May 9, 2017
aa83612
PR feedback: testing lifecycle methods and visible; file rename
monfera May 9, 2017
7427284
PR feedback: hover tooltip tests; switching to addTraces
monfera May 9, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/traces/sankey/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,26 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
}

coerce('node.label');
coerce('node.label', []);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a constant, can it be the attribute dflt?

coerce('node.pad');
coerce('node.thickness');
coerce('node.line.color');
coerce('node.line.width');

var defaultNodePalette = function(i) {return colors[i % colors.length];};

coerce('node.color', traceIn.node.label.map(function(d, i) {
coerce('node.color', traceOut.node.label.map(function(d, i) {
return Color.addOpacity(defaultNodePalette(i), 0.8);
}));

coerce('link.label');
coerce('link.source');
coerce('link.target');
coerce('link.value');
coerce('link.source', []);
coerce('link.target', []);
coerce('link.value', []);
coerce('link.line.color');
coerce('link.line.width');

coerce('link.color', traceIn.link.value.map(function() {
coerce('link.color', traceOut.link.value.map(function() {
return tinycolor(layout.paper_bgcolor).getLuminance() < 0.333 ?
'rgba(255, 255, 255, 0.6)' :
'rgba(0, 0, 0, 0.2)';
Expand All @@ -78,10 +78,11 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
Lib.coerceFont(coerce, 'textfont', Lib.extendFlat({}, layout.font));

var missing = function(n, i) {
return traceIn.link.source.indexOf(i) === -1 &&
traceIn.link.target.indexOf(i) === -1;
return traceOut.link.source.indexOf(i) === -1 &&
traceOut.link.target.indexOf(i) === -1;
};
if(traceIn.node.label.some(missing)) {

if(traceOut.node.label.some(missing)) {
Lib.log('Some of the nodes are neither sources nor targets, please remove them.');
}

Expand Down