Skip to content

Commit 149ef70

Browse files
Add autorange computation
1 parent b496641 commit 149ef70

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/components/rangeslider/defaults.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,9 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) {
6262
coerceRange(yName, 'rangemode', 'auto');
6363
}
6464

65-
coerceRange(yName, 'range');
6665
layoutOut[yName].cleanRange('rangeslider.' + yName + '.range');
67-
layoutOut[axName].rangeslider[yName].range = layoutOut[yName].rangeslider[yName].range.slice();
66+
coerceRange(yName, 'range', layoutOut[yName].rangeslider[yName].range.slice());
6867
delete layoutOut[yName].rangeslider;
69-
70-
/*if(ax.rangeslidermode === 'auto') {
71-
ax.rangesliderrange = hasDeps ? axes.getAutoRange(ax) : ax.range.slice();
72-
axIn = ax._input;
73-
axIn.rangesliderrange = ax.rangesliderrange.slice();
74-
}*/
7568
}
7669

7770
// to map back range slider (auto) range

src/plots/cartesian/axes.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,17 @@ axes.doAutoRange = function(ax) {
367367
axIn.range = ax.range.slice();
368368
axIn.autorange = ax.autorange;
369369
}
370+
371+
if(ax.rangeslider) {
372+
var anchorAxis = ax._anchorAxis;
373+
if(ax.rangeslider[anchorAxis._name].rangemode === 'auto') {
374+
hasDeps = (anchorAxis._min && anchorAxis._max && anchorAxis._min.length && anchorAxis._max.length);
375+
ax.rangeslider[anchorAxis._name].range = hasDeps ? axes.getAutoRange(anchorAxis) : anchorAxis.range.slice();
376+
axIn = ax._input;
377+
axIn.rangeslider[anchorAxis._name].range = ax.rangeslider[anchorAxis._name].range.slice();
378+
axIn.rangeslider[anchorAxis._name].rangemode = ax.rangeslider[anchorAxis._name].rangemode;
379+
}
380+
}
370381
};
371382

372383
// save a copy of the initial axis ranges in fullLayout

0 commit comments

Comments
 (0)