Skip to content

Commit c9592a7

Browse files
committed
Only call nodeSort for non-circular Sankey
1 parent a3f8d69 commit c9592a7

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/traces/sankey/render.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function sankeyModel(layout, d, traceIndex) {
4040
right: d3Sankey.sankeyRight,
4141
center: d3Sankey.sankeyCenter
4242
}[trace.node.align];
43-
var input_sort = trace.node.sort == 'input';
43+
var input_sort = trace.node.sort === 'input';
4444

4545
var width = layout.width * (domain.x[1] - domain.x[0]);
4646
var height = layout.height * (domain.y[1] - domain.y[0]);
@@ -49,6 +49,10 @@ function sankeyModel(layout, d, traceIndex) {
4949
var links = calcData._links;
5050
var circular = calcData.circular;
5151

52+
if(circular && input_sort) {
53+
Lib.error('Circular Sankey diagrams do not support the "input" node.sort mode; falling back to the default sort.');
54+
}
55+
5256
// Select Sankey generator
5357
var sankey;
5458
if(circular) {
@@ -68,10 +72,14 @@ function sankeyModel(layout, d, traceIndex) {
6872
return d.pointNumber;
6973
})
7074
.nodeAlign(nodeAlign)
71-
.nodeSort(input_sort ? null : undefined)
7275
.nodes(nodes)
7376
.links(links);
7477

78+
// d3-sankey-circular does not support the nodeSort method
79+
if(!circular) {
80+
sankey.nodeSort(input_sort ? null : undefined);
81+
}
82+
7583
var graph = sankey();
7684

7785
if(sankey.nodePadding() < nodePad) {

0 commit comments

Comments
 (0)