Skip to content

Commit 6fd6919

Browse files
committed
fixup relayout for 'grid.(x|y)side'
1 parent 9d0bcfd commit 6fd6919

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

src/components/grid/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ var gridAttrs = {
143143
values: ['bottom', 'bottom plot', 'top plot', 'top'],
144144
dflt: 'bottom plot',
145145
role: 'info',
146-
editType: 'ticks',
146+
editType: 'plot',
147147
description: [
148148
'Sets where the x axis labels and titles go. *bottom* means',
149149
'the very bottom of the grid. *bottom plot* is the lowest plot',
@@ -155,7 +155,7 @@ var gridAttrs = {
155155
values: ['left', 'left plot', 'right plot', 'right'],
156156
dflt: 'left plot',
157157
role: 'info',
158-
editType: 'ticks',
158+
editType: 'plot',
159159
description: [
160160
'Sets where the y axis labels and titles go. *left* means',
161161
'the very left edge of the grid. *left plot* is the leftmost plot',

test/jasmine/tests/splom_test.js

+42
Original file line numberDiff line numberDiff line change
@@ -502,4 +502,46 @@ describe('@gl Test splom interactions:', function() {
502502
.catch(failTest)
503503
.then(done);
504504
});
505+
506+
it('should correctly move axis layers when relayouting *grid.(x|y)side*', function(done) {
507+
var fig = Lib.extendDeep({}, require('@mocks/splom_upper-nodiag.json'));
508+
509+
function _assert(exp) {
510+
var g = d3.select(gd).select('g.cartesianlayer');
511+
for(var k in exp) {
512+
// all ticks are set to same position,
513+
// only check first one
514+
var tick0 = g.select('g.' + k + 'tick > text');
515+
var pos = {x: 'y', y: 'x'}[k.charAt(0)];
516+
expect(+tick0.attr(pos))
517+
.toBeWithin(exp[k], 1, pos + ' position for axis ' + k);
518+
}
519+
}
520+
521+
Plotly.plot(gd, fig).then(function() {
522+
expect(gd._fullLayout.grid.xside).toBe('bottom', 'sanity check dflt grid.xside');
523+
expect(gd._fullLayout.grid.yside).toBe('left', 'sanity check dflt grid.yside');
524+
525+
_assert({
526+
x: 433, x2: 433, x3: 433,
527+
y: 80, y2: 80, y3: 80
528+
});
529+
return Plotly.relayout(gd, 'grid.yside', 'left plot');
530+
})
531+
.then(function() {
532+
_assert({
533+
x: 433, x2: 433, x3: 433,
534+
y: 79, y2: 230, y3: 382
535+
});
536+
return Plotly.relayout(gd, 'grid.xside', 'bottom plot');
537+
})
538+
.then(function() {
539+
_assert({
540+
x: 212, x2: 323, x3: 433,
541+
y: 79, y2: 230, y3: 382
542+
});
543+
})
544+
.catch(failTest)
545+
.then(done);
546+
});
505547
});

0 commit comments

Comments
 (0)