Skip to content

Commit cc1b3de

Browse files
committed
fixup and 🔒 dragbox with linked y axes
1 parent d3fe40d commit cc1b3de

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/plots/cartesian/dragbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ function calcLinks(gd, xaHash, yaHash) {
11051105
var yaHashLinked = {};
11061106
var yaxesLinked = [];
11071107
for(yLinkID in yLinks) {
1108-
var ya = getFromId(gd, xLinkID);
1108+
var ya = getFromId(gd, yLinkID);
11091109
yaxesLinked.push(ya);
11101110
yaHashLinked[ya._id] = ya;
11111111
}

test/jasmine/tests/cartesian_interact_test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,30 @@ describe('axis zoom/pan and main plot zoom', function() {
530530
.catch(failTest)
531531
.then(done);
532532
});
533+
534+
it('updates linked axes when there are constraints (axes_scaleanchor mock)', function(done) {
535+
var fig = Lib.extendDeep({}, require('@mocks/axes_scaleanchor.json'));
536+
537+
function _assert(y3rng, y4rng) {
538+
expect(gd._fullLayout.yaxis3.range).toBeCloseToArray(y3rng, 2, 'y3 rng');
539+
expect(gd._fullLayout.yaxis4.range).toBeCloseToArray(y4rng, 2, 'y3 rng');
540+
}
541+
542+
Plotly.plot(gd, fig)
543+
.then(function() {
544+
_assert([-0.36, 4.36], [-0.36, 4.36]);
545+
})
546+
.then(doDrag('x2y3', 'nsew', 0, 100))
547+
.then(function() {
548+
_assert([-0.36, 2], [0.82, 3.18]);
549+
})
550+
.then(doDrag('x2y4', 'nsew', 0, 50))
551+
.then(function() {
552+
_assert([0.41, 1.23], [1.18, 2]);
553+
})
554+
.catch(failTest)
555+
.then(done);
556+
});
533557
});
534558

535559
describe('Event data:', function() {

0 commit comments

Comments
 (0)