Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heatmapgl with axis constraints #5476

Merged
merged 2 commits into from
Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/plots/gl2d/scene2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,10 @@ proto.plot = function(fullData, calcData, fullLayout) {
options.screenBox = [0, 0, width, height];

var mockGraphDiv = {_fullLayout: {
_axisConstraintGroups: this.graphDiv._fullLayout._axisConstraintGroups,
_axisConstraintGroups: fullLayout._axisConstraintGroups,
xaxis: this.xaxis,
yaxis: this.yaxis
yaxis: this.yaxis,
_size: fullLayout._size
}};

cleanAxisConstraints(mockGraphDiv, this.xaxis);
Expand Down
32 changes: 32 additions & 0 deletions test/jasmine/tests/heatmapgl_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ var Plotly = require('@lib/index');
var schema = Plotly.PlotSchema.get();
var attributeList = Object.getOwnPropertyNames(schema.traces.heatmapgl.attributes);

var createGraphDiv = require('../assets/create_graph_div');
var destroyGraphDiv = require('../assets/destroy_graph_div');

describe('heatmapgl supplyDefaults', function() {
'use strict';

Expand Down Expand Up @@ -97,3 +100,32 @@ describe('heatmapgl supplyDefaults', function() {
});
});
});

describe('heatmapgl plotting', function() {
var gd;

beforeEach(function() {
gd = createGraphDiv();
});

afterEach(destroyGraphDiv);

it('can do scaleanchor', function(done) {
var data = [{
z: [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
type: 'heatmapgl',
showscale: false
}];
var layout = {
xaxis: {scaleanchor: 'y'},
width: 500,
height: 300,
margin: {l: 50, r: 50, t: 50, b: 50}
};
Plotly.newPlot(gd, data, layout)
.then(function() {
expect(layout.xaxis.range).toBeCloseToArray([-1, 3], 3);
})
.then(done, done.fail);
});
});