Skip to content

Commit df051d4

Browse files
committed
don't skip over dtick and tick0 in geo subplot in diffLayout
- tick0 and dtick *do* have defaults (filled in supplyDefaults), which make them compatible with the stock diffing algorithm.
1 parent e545415 commit df051d4

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

src/plot_api/plot_api.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -2444,14 +2444,15 @@ function getDiffFlags(oldContainer, newContainer, outerparts, opts) {
24442444

24452445
if(key.charAt(0) === '_' || typeof oldVal === 'function' || oldVal === newVal) continue;
24462446

2447-
// FIXME: ax.tick0 and dtick get filled in during plotting, and unlike other auto values
2448-
// they don't make it back into the input, so newContainer won't have them.
2449-
// similar for axis ranges for 3D
2450-
// contourcarpet doesn't HAVE zmin/zmax, they're just auto-added. It needs them.
2451-
if(key === 'tick0' || key === 'dtick') {
2447+
// FIXME: ax.tick0 and dtick get filled in during plotting (except for geo subplots),
2448+
// and unlike other auto values they don't make it back into the input,
2449+
// so newContainer won't have them.
2450+
if((key === 'tick0' || key === 'dtick') && outerparts[0] !== 'geo') {
24522451
var tickMode = newContainer.tickmode;
24532452
if(tickMode === 'auto' || tickMode === 'array' || !tickMode) continue;
24542453
}
2454+
// FIXME: Similarly for axis ranges for 3D
2455+
// contourcarpet doesn't HAVE zmin/zmax, they're just auto-added. It needs them.
24552456
if(key === 'range' && newContainer.autorange) continue;
24562457
if((key === 'zmin' || key === 'zmax') && newContainer.type === 'contourcarpet') continue;
24572458

test/jasmine/tests/plot_api_test.js

+31
Original file line numberDiff line numberDiff line change
@@ -2784,6 +2784,37 @@ describe('Test plot api', function() {
27842784
.then(done);
27852785
});
27862786

2787+
it('picks up special dtick geo case', function(done) {
2788+
var data = [{type: 'scattergeo'}];
2789+
var layout = {};
2790+
2791+
function countLines() {
2792+
var path = d3.select(gd).select('.lataxis > path');
2793+
return path.attr('d').split('M').length;
2794+
}
2795+
2796+
Plotly.react(gd, data)
2797+
.then(countPlots)
2798+
.then(function() {
2799+
layout.geo = {lataxis: {showgrid: true, dtick: 10}};
2800+
return Plotly.react(gd, data, layout);
2801+
})
2802+
.then(function() {
2803+
countCalls({plot: 1});
2804+
expect(countLines()).toBe(18);
2805+
})
2806+
.then(function() {
2807+
layout.geo.lataxis.dtick = 30;
2808+
return Plotly.react(gd, data, layout);
2809+
})
2810+
.then(function() {
2811+
countCalls({plot: 1});
2812+
expect(countLines()).toBe(6);
2813+
})
2814+
.catch(failTest)
2815+
.then(done);
2816+
});
2817+
27872818
it('picks up minimal sequence for cartesian axis range updates', function(done) {
27882819
var data = [{y: [1, 2, 1]}];
27892820
var layout = {xaxis: {range: [1, 2]}};

0 commit comments

Comments
 (0)