Skip to content

Commit 3cba316

Browse files
committed
sankey: fix syntax
1 parent 320a4c4 commit 3cba316

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/traces/sankey/render.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,17 @@ function sankeyModel(layout, d, traceIndex) {
6969
Lib.warn('node.pad was reduced to ', sankey.nodePadding(), ' to fit within the figure.');
7070
}
7171

72+
// Counters for nested loops
73+
var i, j, k;
74+
7275
// Create transient nodes for animations
7376
for(var nodePointNumber in calcData._groupLookup) {
7477
var groupIndex = parseInt(calcData._groupLookup[nodePointNumber]);
7578

7679
// Find node representing groupIndex
7780
var groupingNode;
78-
for(var i = 0; i < graph.nodes.length; i++) {
81+
82+
for(i = 0; i < graph.nodes.length; i++) {
7983
if(graph.nodes[i].pointNumber === groupIndex) {
8084
groupingNode = graph.nodes[i];
8185
break;
@@ -100,7 +104,6 @@ function sankeyModel(layout, d, traceIndex) {
100104
}
101105

102106
function computeLinkConcentrations() {
103-
var i, j, k;
104107
for(i = 0; i < graph.nodes.length; i++) {
105108
var node = graph.nodes[i];
106109
// Links connecting the same two nodes are part of a flow
@@ -167,7 +170,6 @@ function sankeyModel(layout, d, traceIndex) {
167170

168171
// Force node position
169172
if(trace.node.x.length !== 0 && trace.node.y.length !== 0) {
170-
var i;
171173
for(i = 0; i < Math.min(trace.node.x.length, trace.node.y.length, graph.nodes.length); i++) {
172174
if(trace.node.x[i] && trace.node.y[i]) {
173175
var pos = [trace.node.x[i] * width, trace.node.y[i] * height];

0 commit comments

Comments
 (0)