Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e365e8e

Browse filesBrowse files
authored
Merge pull request #7032 from plotly/zorder-overlays
Handle `zorder` between overlayed cartesian subplots
2 parents 491ef1c + 3150069 commit e365e8e
Copy full SHA for e365e8e

15 files changed

+350
-139
lines changed

‎src/components/fx/hover.js

Copy file name to clipboardExpand all lines: src/components/fx/hover.js
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var Drawing = require('../drawing');
1515
var Color = require('../color');
1616
var dragElement = require('../dragelement');
1717
var Axes = require('../../plots/cartesian/axes');
18+
var zindexSeparator = require('../../plots/cartesian/constants').zindexSeparator;
1819
var Registry = require('../../registry');
1920

2021
var helpers = require('./helpers');
@@ -261,6 +262,11 @@ exports.loneHover = function loneHover(hoverItems, opts) {
261262
function _hover(gd, evt, subplot, noHoverEvent, eventTarget) {
262263
if(!subplot) subplot = 'xy';
263264

265+
if(typeof subplot === 'string') {
266+
// drop zindex from subplot id
267+
subplot = subplot.split(zindexSeparator)[0];
268+
}
269+
264270
// if the user passed in an array of subplots,
265271
// use those instead of finding overlayed plots
266272
var subplots = Array.isArray(subplot) ? subplot : [subplot];

‎src/plot_api/subroutines.js

Copy file name to clipboardExpand all lines: src/plot_api/subroutines.js
+3-1Lines changed: 3 additions & 1 deletion
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

Copy file name to clipboardExpand all lines: src/plots/cartesian/constants.js
+3-1Lines changed: 3 additions & 1 deletion
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.