Skip to content

Commit 7776305

Browse files
committed
handle invalid range and reversed autorange
1 parent faccfc6 commit 7776305

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/plots/cartesian/axis_defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
103103
// validate range and set autorange true for invalid partial ranges
104104
if(range && (
105105
(range[0] === null && range[1] === null) ||
106+
((range[0] === null || range[1] === null) && autorange === 'reversed') ||
106107
(range[0] !== null && (autorange === 'min' || autorange === 'max reversed')) ||
107108
(range[1] !== null && (autorange === 'max' || autorange === 'min reversed'))
108109
)) {

src/plots/polar/layout_defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
8888
// validate range and set autorange true for invalid partial ranges
8989
if(range && (
9090
(range[0] === null && range[1] === null) ||
91+
((range[0] === null || range[1] === null) && autorange === 'reversed') ||
9192
(range[0] !== null && (autorange === 'min' || autorange === 'max reversed')) ||
9293
(range[1] !== null && (autorange === 'max' || autorange === 'min reversed'))
9394
)) {

test/jasmine/tests/axes_test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,11 @@ describe('Test axes', function() {
727727
yaxis5: { range: [null, 2], autorange: 'max' }, // first range is null not second
728728
yaxis6: { range: [1, null], autorange: 'max reversed' }, // second range is null not first
729729
yaxis7: { range: [null, 2], autorange: 'min reversed' }, // first range is null not second
730+
yaxis8: { range: [1, null], autorange: 'reversed' },
731+
yaxis9: { range: [null, 2], autorange: 'reversed' },
730732
};
731-
layoutOut._subplots.cartesian.push('x2y2', 'xy3', 'x3y4', 'x3y5', 'x3y6', 'x3y7');
732-
layoutOut._subplots.yaxis.push('x2', 'x3', 'y2', 'y3', 'y4', 'y5', 'y6', 'y7');
733+
layoutOut._subplots.cartesian.push('x2y2', 'xy3', 'x3y4', 'x3y5', 'x3y6', 'x3y7', 'x3y9', 'x3y9');
734+
layoutOut._subplots.yaxis.push('x2', 'x3', 'y2', 'y3', 'y4', 'y5', 'y6', 'y7', 'y8', 'y9');
733735

734736
supplyLayoutDefaults(layoutIn, layoutOut, fullData);
735737

0 commit comments

Comments
 (0)