Skip to content

Commit 8ed564c

Browse files
committed
handle zorder between overlayed cartesian subplots
- by adding zindex layers e.g. xyz2, x2yz2, xy2z2, x2y2z2, etc. - move zorder logic from plotOne subplot to plot all subplots - add test
1 parent 10acb04 commit 8ed564c

File tree

5 files changed

+307
-119
lines changed

5 files changed

+307
-119
lines changed

src/plot_api/subroutines.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ var SVG_TEXT_ANCHOR_START = 'start';
2424
var SVG_TEXT_ANCHOR_MIDDLE = 'middle';
2525
var SVG_TEXT_ANCHOR_END = 'end';
2626

27+
var zindexSeparator = require('../plots/cartesian/constants').zindexSeparator;
28+
2729
exports.layoutStyles = function(gd) {
2830
return Lib.syncOrAsync([Plots.doAutoMargin, lsInner], gd);
2931
};
@@ -135,7 +137,7 @@ function lsInner(gd) {
135137
var yDomain = plotinfo.yaxis.domain;
136138
var plotgroup = plotinfo.plotgroup;
137139

138-
if(overlappingDomain(xDomain, yDomain, lowerDomains)) {
140+
if(overlappingDomain(xDomain, yDomain, lowerDomains) && subplot.indexOf(zindexSeparator) === -1) {
139141
var pgNode = plotgroup.node();
140142
var plotgroupBg = plotinfo.bg = Lib.ensureSingle(plotgroup, 'rect', 'bg');
141143
pgNode.insertBefore(plotgroupBg.node(), pgNode.childNodes[0]);

src/plots/cartesian/constants.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,7 @@ module.exports = {
6666
layerValue2layerClass: {
6767
'above traces': 'above',
6868
'below traces': 'below'
69-
}
69+
},
70+
71+
zindexSeparator: 'z', // used for zindex of cartesian subplots e.g. xy, xyz2, xyz3, etc.
7072
};

0 commit comments

Comments
 (0)