Skip to content

Commit 30a7960

Browse files
committed
clear axis _min and _max after transform calc loop
- so that axis autorange is computed after transfroms are made.
1 parent 0003e22 commit 30a7960

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/plots/plots.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,12 @@ plots.doCalcdata = function(gd, traces) {
19841984
}
19851985
}
19861986

1987+
// clear stuff ...
1988+
for(i = 0; i < axList.length; i++) {
1989+
axList[i]._min = [];
1990+
axList[i]._max = [];
1991+
}
1992+
19871993
// 'regular' loop
19881994
for(i = 0; i < fullData.length; i++) {
19891995
var cd = [];

test/jasmine/tests/transform_filter_test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var createGraphDiv = require('../assets/create_graph_div');
88
var destroyGraphDiv = require('../assets/destroy_graph_div');
99
var assertDims = require('../assets/assert_dims');
1010
var assertStyle = require('../assets/assert_style');
11+
var customMatchers = require('../assets/custom_matchers');
1112

1213
describe('filter transforms defaults:', function() {
1314

@@ -844,6 +845,10 @@ describe('filter transforms calc:', function() {
844845
describe('filter transforms interactions', function() {
845846
'use strict';
846847

848+
beforeAll(function() {
849+
jasmine.addMatchers(customMatchers);
850+
});
851+
847852
var mockData0 = [{
848853
x: [-2, -1, -2, 0, 1, 2, 3],
849854
y: [1, 2, 3, 1, 2, 3, 1],
@@ -898,6 +903,9 @@ describe('filter transforms interactions', function() {
898903
assertUid(gd);
899904
assertStyle(dims, ['rgb(255, 0, 0)'], [1]);
900905

906+
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([0.87, 3.13]);
907+
expect(gd._fullLayout.yaxis.range).toBeCloseToArray([0.85, 3.15]);
908+
901909
return Plotly.restyle(gd, 'marker.color', 'blue');
902910
}).then(function() {
903911
expect(gd._fullData[0].marker.color).toEqual('blue');
@@ -915,6 +923,9 @@ describe('filter transforms interactions', function() {
915923
assertUid(gd);
916924
assertStyle([1], ['rgb(255, 0, 0)'], [1]);
917925

926+
expect(gd._fullLayout.xaxis.range).toBeCloseToArray([2, 4]);
927+
expect(gd._fullLayout.yaxis.range).toBeCloseToArray([0, 2]);
928+
918929
done();
919930
});
920931
});

0 commit comments

Comments
 (0)