Skip to content

Commit eba1629

Browse files
committed
fix #5474 heatmapgl with axis constraints
1 parent 89e27be commit eba1629

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

src/plots/gl2d/scene2d.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,10 @@ proto.plot = function(fullData, calcData, fullLayout) {
401401
options.screenBox = [0, 0, width, height];
402402

403403
var mockGraphDiv = {_fullLayout: {
404-
_axisConstraintGroups: this.graphDiv._fullLayout._axisConstraintGroups,
404+
_axisConstraintGroups: fullLayout._axisConstraintGroups,
405405
xaxis: this.xaxis,
406-
yaxis: this.yaxis
406+
yaxis: this.yaxis,
407+
_size: fullLayout._size
407408
}};
408409

409410
cleanAxisConstraints(mockGraphDiv, this.xaxis);

test/jasmine/tests/heatmapgl_test.js

+32
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ var Plotly = require('@lib/index');
44
var schema = Plotly.PlotSchema.get();
55
var attributeList = Object.getOwnPropertyNames(schema.traces.heatmapgl.attributes);
66

7+
var createGraphDiv = require('../assets/create_graph_div');
8+
var destroyGraphDiv = require('../assets/destroy_graph_div');
9+
710
describe('heatmapgl supplyDefaults', function() {
811
'use strict';
912

@@ -97,3 +100,32 @@ describe('heatmapgl supplyDefaults', function() {
97100
});
98101
});
99102
});
103+
104+
describe('heatmapgl plotting', function() {
105+
var gd;
106+
107+
beforeEach(function() {
108+
gd = createGraphDiv();
109+
});
110+
111+
afterEach(destroyGraphDiv);
112+
113+
it('can do scaleanchor', function(done) {
114+
var data = [{
115+
z: [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
116+
type: 'heatmapgl',
117+
showscale: false
118+
}];
119+
var layout = {
120+
xaxis: {scaleanchor: 'y'},
121+
width: 500,
122+
height: 300,
123+
margin: {l: 50, r: 50, t: 50, b: 50}
124+
};
125+
Plotly.newPlot(gd, data, layout)
126+
.then(function() {
127+
expect(layout.xaxis.range).toBeCloseToArray([-1, 3], 3);
128+
})
129+
.then(done, done.fail);
130+
});
131+
});

0 commit comments

Comments
 (0)