Skip to content

Commit c805713

Browse files
committed
put main subplot plot inside overplot
1 parent 895517f commit c805713

File tree

9 files changed

+18
-14
lines changed

9 files changed

+18
-14
lines changed

src/plots/cartesian/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,9 @@ function makeSubplotLayer(gd, plotinfo) {
507507
ensureSingle(plotgroup, 'g', 'yaxislayer-below');
508508
plotinfo.overaxesBelow = ensureSingle(plotgroup, 'g', 'overaxes-below');
509509

510-
plotinfo.plot = ensureSingle(plotgroup, 'g', 'plot');
510+
ensureSingle(plotgroup, 'g', 'plot');
511511
plotinfo.overplot = ensureSingle(plotgroup, 'g', 'overplot');
512+
plotinfo.plot = ensureSingle(plotinfo.overplot, 'g', id);
512513

513514
plotinfo.xlines = ensureSingle(plotgroup, 'path', 'xlines-above');
514515
plotinfo.ylines = ensureSingle(plotgroup, 'path', 'ylines-above');

test/jasmine/tests/animate_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ describe('animating scatter traces', function() {
10081008

10091009
// assert what Cartesian.transitionAxes does
10101010
function getSubplotTranslate() {
1011-
var sp = d3Select(gd).select('.subplot.xy > .plot');
1011+
var sp = d3Select(gd).select('.subplot.xy > .overplot').select('.xy');
10121012
return sp.attr('transform')
10131013
.split('translate(')[1].split(')')[0]
10141014
.split(',')

test/jasmine/tests/bar_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2087,7 +2087,7 @@ describe('A bar plot', function() {
20872087
}
20882088

20892089
function _assert(layerClips, barDisplays, barTextDisplays, barClips) {
2090-
var subplotLayer = d3Select('.plot');
2090+
var subplotLayer = d3Select('.overplot').select('.xy');
20912091
var barLayer = subplotLayer.select('.barlayer');
20922092

20932093
_assertClip(subplotLayer, layerClips[0], 1, 'subplot layer');

test/jasmine/tests/cartesian_interact_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,7 @@ describe('axis zoom/pan and main plot zoom', function() {
15921592
[['yaxis'], [-0.318, 3.318]],
15931593
[['xaxis2', 'yaxis2'], [-0.588, 8.824]]
15941594
]);
1595-
x2y2 = d3Select('.subplot.x2y2 .plot');
1595+
x2y2 = d3Select('.subplot.x2y2 .overplot').select('.x2y2');
15961596
expect(x2y2.attr('transform')).toBe('translate(50,50)');
15971597
mx = gd._fullLayout.xaxis._m;
15981598
my = gd._fullLayout.yaxis._m;

test/jasmine/tests/cartesian_test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ describe('subplot creation / deletion:', function() {
609609
var fig = Lib.extendDeep({}, require('../../image/mocks/overlaying-axis-lines.json'));
610610

611611
function _assert(xyCnt, x2y2Cnt) {
612-
expect(d3Select('.subplot.xy').select('.plot').selectAll('.trace').size())
612+
expect(d3Select('.subplot.xy').select('.overplot').select('.xy').selectAll('.trace').size())
613613
.toBe(xyCnt, 'has correct xy subplot trace count');
614614
expect(d3Select('.overplot').select('.x2y2').selectAll('.trace').size())
615615
.toBe(x2y2Cnt, 'has correct x2y2 oveylaid subplot trace count');
@@ -759,7 +759,7 @@ describe('subplot creation / deletion:', function() {
759759
_assert('x2/y2 both overlays', {
760760
xtickParent: 'xaxislayer-above',
761761
x2tickParent: 'x2y2-x',
762-
trace0Parent: 'plot',
762+
trace0Parent: 'xy',
763763
trace1Parent: 'x2y2'
764764
});
765765
})
@@ -770,8 +770,8 @@ describe('subplot creation / deletion:', function() {
770770
_assert('x2 free / y2 overlaid', {
771771
xtickParent: 'xaxislayer-above',
772772
x2tickParent: 'xaxislayer-above',
773-
trace0Parent: 'plot',
774-
trace1Parent: 'plot'
773+
trace0Parent: 'xy',
774+
trace1Parent: 'x2y2'
775775
});
776776
})
777777
.then(function() {
@@ -781,7 +781,7 @@ describe('subplot creation / deletion:', function() {
781781
_assert('back to x2/y2 both overlays', {
782782
xtickParent: 'xaxislayer-above',
783783
x2tickParent: 'x2y2-x',
784-
trace0Parent: 'plot',
784+
trace0Parent: 'xy',
785785
trace1Parent: 'x2y2'
786786
});
787787
})

test/jasmine/tests/click_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,14 +1182,14 @@ describe('dragbox', function() {
11821182
var pos = getRectCenter(node);
11831183
var fns = drag.makeFns({pos0: pos, dpos: [50, 0]});
11841184

1185-
assertScale(d3Select('.plot').node(), 1, 1);
1185+
assertScale(d3Select('.overplot').select('.xy').node(), 1, 1);
11861186

11871187
d3SelectAll('.point').each(function() {
11881188
assertScale(this, 1, 1);
11891189
});
11901190

11911191
fns.start().then(function() {
1192-
assertScale(d3Select('.plot').node(), 1.14, 1);
1192+
assertScale(d3Select('.overplot').select('.xy').node(), 1.14, 1);
11931193

11941194
d3Select('.scatterlayer').selectAll('.point').each(function() {
11951195
assertScale(this, 0.87, 1);

test/jasmine/tests/scatter_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2053,7 +2053,7 @@ describe('Test scatter *clipnaxis*:', function() {
20532053
}
20542054

20552055
function _assert(layerClips, nodeDisplays, errorBarClips, lineClips) {
2056-
var subplotLayer = d3Select('.plot');
2056+
var subplotLayer = d3Select('.overplot').select('.xy');
20572057
var scatterLayer = subplotLayer.select('.scatterlayer');
20582058

20592059
_assertClip(subplotLayer, layerClips[0], 1, 'subplot layer');

test/jasmine/tests/select_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,7 @@ describe('Test select box and lasso per trace:', function() {
31123112
var assertSelectedPoints = makeAssertSelectedPoints();
31133113

31143114
function assertFillOpacity(exp, msg) {
3115-
var txtPts = d3Select(gd).select('g.plot').selectAll('text');
3115+
var txtPts = d3Select(gd).select('g.overplot').select('.xy').selectAll('text');
31163116

31173117
expect(txtPts.size()).toBe(exp.length, '# of text nodes: ' + msg);
31183118

test/jasmine/tests/toimage_test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ describe('Plotly.toImage', function() {
240240
})
241241
.then(function(svg) {
242242
var svgDOM = parser.parseFromString(svg, 'image/svg+xml');
243-
var gSubplot = svgDOM.getElementsByClassName('plot')[0];
243+
var gSubplot = svgDOM
244+
.getElementsByClassName('overplot')[0]
245+
.getElementsByClassName('xy')[0];
246+
244247
var clipPath = gSubplot.getAttribute('clip-path');
245248
var len = clipPath.length;
246249

0 commit comments

Comments
 (0)