Skip to content

Commit 121a664

Browse files
committed
partial insiderange support is out of scope at this point
1 parent 15b6bf2 commit 121a664

File tree

4 files changed

+18
-160
lines changed

4 files changed

+18
-160
lines changed

Diff for: src/plots/cartesian/range_defaults.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,18 @@ module.exports = function handleRangeDefaults(containerIn, containerOut, coerce,
1414
var insiderange;
1515
if(!options.noInsiderange && axType !== 'log') {
1616
insiderange = coerce('insiderange');
17-
range = coerce('range', insiderange);
17+
18+
// We may support partial insideranges in future
19+
// For now it is out of scope
20+
if(insiderange && (
21+
insiderange[0] === null ||
22+
insiderange[1] === null
23+
)) {
24+
containerOut.insiderange = false;
25+
insiderange = undefined;
26+
}
27+
28+
if(insiderange) range = coerce('range', insiderange);
1829
}
1930
}
2031

Diff for: test/image/baselines/zz-insiderange-x-partial.png

-84.4 KB
Binary file not shown.

Diff for: test/image/mocks/zz-insiderange-x-partial.json

-97
This file was deleted.

Diff for: test/jasmine/tests/click_test.js

+6-62
Original file line numberDiff line numberDiff line change
@@ -1047,85 +1047,29 @@ describe('Test click interactions:', function() {
10471047
.then(done, done.fail);
10481048
});
10491049

1050-
it('when set to \'reset+autorange\' (the default) should autosize on 1st and 2nd double clicks (*min* partial insiderange and inside tick lables)', function(done) {
1050+
it('when set to \'reset+autorange\' (the default) should autosize on 1st and 2nd double clicks (insiderange and inside tick lables)', function(done) {
10511051
mockCopy = setRanges(mockCopy);
10521052

10531053
Plotly.newPlot(gd, [{
1054-
y: [1, 3, 2]}
1054+
y: [0, 1, 2, 3]}
10551055
], {
1056-
xaxis: {insiderange: [null, 1]},
1057-
yaxis: {ticks: 'inside', ticklabelposition: 'inside'},
1058-
plot_bgcolor: 'lightgray',
1059-
width: 600,
1060-
height: 600
1061-
}).then(function() {
1062-
expect(gd.layout.xaxis.range).toBeCloseToArray([-0.166, 1]);
1063-
1064-
return doubleClick(300, 300);
1065-
})
1066-
.then(function() {
1067-
expect(gd.layout.xaxis.range).toBeCloseToArray([-0.166, 2.134]);
1068-
1069-
return doubleClick(300, 300);
1070-
})
1071-
.then(function() {
1072-
expect(gd.layout.xaxis.range).toBeCloseToArray([-0.166, 1]);
1073-
})
1074-
.then(done, done.fail);
1075-
});
1076-
1077-
it('when set to \'reset+autorange\' (the default) should autosize on 1st and 2nd double clicks (*max* partial insiderange and inside tick lables)', function(done) {
1078-
mockCopy = setRanges(mockCopy);
1079-
1080-
Plotly.newPlot(gd, [{
1081-
y: [2, 3, 1]}
1082-
], {
1083-
xaxis: {insiderange: [1, null]},
1056+
xaxis: {insiderange: [1, 2]},
10841057
yaxis: {ticks: 'inside', ticklabelposition: 'inside', side: 'right'},
10851058
plot_bgcolor: 'lightgray',
10861059
width: 600,
10871060
height: 600
10881061
}).then(function() {
1089-
expect(gd.layout.xaxis.range).toBeCloseToArray([1, 2.166]);
1090-
1091-
return doubleClick(300, 300);
1092-
})
1093-
.then(function() {
1094-
expect(gd.layout.xaxis.range).toBeCloseToArray([-0.134, 2.166]);
1095-
1096-
return doubleClick(300, 300);
1097-
})
1098-
.then(function() {
1099-
expect(gd.layout.xaxis.range).toBeCloseToArray([1, 2.166]);
1100-
})
1101-
.then(done, done.fail);
1102-
});
1103-
1104-
it('when set to \'reset+autorange\' (the default) should autosize on 1st and 2nd double clicks (case of partial ranges reversed)', function(done) {
1105-
mockCopy = setRanges(mockCopy);
1106-
1107-
Plotly.newPlot(gd, [{
1108-
y: [1, 2, 3, 4]}
1109-
], {
1110-
xaxis: {range: [null, 1], autorange: 'max reversed'},
1111-
yaxis: {range: [3, null], autorange: 'min reversed'},
1112-
width: 600,
1113-
height: 600
1114-
}).then(function() {
1115-
expect(gd.layout.xaxis.range).toBeCloseToArray([3.2, 1]);
1116-
expect(gd.layout.yaxis.range).toBeCloseToArray([3, 0.8]);
1062+
expect(gd.layout.xaxis.range).toBeCloseToArray([1, 2.068]);
11171063

11181064
return doubleClick(300, 300);
11191065
})
11201066
.then(function() {
1121-
expect(gd.layout.xaxis.range).toBeCloseToArray([3.2, -0.2]);
1122-
expect(gd.layout.yaxis.range).toBeCloseToArray([4.2, 0.8]);
1067+
expect(gd.layout.xaxis.range).toBeCloseToArray([-0.2019, 3.249]);
11231068

11241069
return doubleClick(300, 300);
11251070
})
11261071
.then(function() {
1127-
expect(gd.layout.xaxis.range).toBeCloseToArray([3.2, 1]);
1128-
expect(gd.layout.yaxis.range).toBeCloseToArray([3, 0.8]);
1072+
expect(gd.layout.xaxis.range).toBeCloseToArray([1, 2.068]);
11291073
})
11301074
.then(done, done.fail);
11311075
});

0 commit comments

Comments
 (0)