diff --git a/src/components/images/draw.js b/src/components/images/draw.js index cd6dfeb698b..c0d82c9494d 100644 --- a/src/components/images/draw.js +++ b/src/components/images/draw.js @@ -5,6 +5,7 @@ var Drawing = require('../drawing'); var Axes = require('../../plots/cartesian/axes'); var axisIds = require('../../plots/cartesian/axis_ids'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); +var zindexSeparator = require('../../plots/cartesian/constants').zindexSeparator; module.exports = function draw(gd) { var fullLayout = gd._fullLayout; @@ -226,6 +227,9 @@ module.exports = function draw(gd) { var allSubplots = Object.keys(fullLayout._plots); for(i = 0; i < allSubplots.length; i++) { subplot = allSubplots[i]; + if (subplot.indexOf(zindexSeparator) !== -1) { + continue; + } var subplotObj = fullLayout._plots[subplot]; // filter out overlaid plots (which have their images on the main plot) diff --git a/src/plot_api/subroutines.js b/src/plot_api/subroutines.js index f7fc8850c23..a50ab1746f3 100644 --- a/src/plot_api/subroutines.js +++ b/src/plot_api/subroutines.js @@ -137,7 +137,10 @@ function lsInner(gd) { var yDomain = plotinfo.yaxis.domain; var plotgroup = plotinfo.plotgroup; - if(overlappingDomain(xDomain, yDomain, lowerDomains) && subplot.indexOf(zindexSeparator) === -1) { + if(overlappingDomain(xDomain, yDomain, lowerDomains) && + subplot.indexOf(zindexSeparator) === -1 && + subplot !== xDomain + yDomain + zindexSeparator + 1 + ) { var pgNode = plotgroup.node(); var plotgroupBg = plotinfo.bg = Lib.ensureSingle(plotgroup, 'rect', 'bg'); pgNode.insertBefore(plotgroupBg.node(), pgNode.childNodes[0]); @@ -258,6 +261,9 @@ function lsInner(gd) { } for(subplot in fullLayout._plots) { + if (subplot.indexOf(zindexSeparator) !== -1) { + continue; + } plotinfo = fullLayout._plots[subplot]; xa = plotinfo.xaxis; ya = plotinfo.yaxis; diff --git a/src/plots/cartesian/index.js b/src/plots/cartesian/index.js index b8f28c6ba6f..b06a82c5206 100644 --- a/src/plots/cartesian/index.js +++ b/src/plots/cartesian/index.js @@ -153,7 +153,7 @@ exports.plot = function(gd, traces, transitionOpts, makeOnCompleteCallback) { var subplot = subplots[i]; var subplotInfo = fullLayout._plots[subplot]; - if(z > 0) { + if(zindices.length > 1) { var idWithZ = subplotInfo.id; if(idWithZ.indexOf(zindexSeparator) !== -1) continue; idWithZ += zindexSeparator + (z + 1); @@ -418,7 +418,7 @@ exports.drawFramework = function(gd) { subplotData[i] = initialSubplotData[i].slice(); } - for(var z = 1; z < zindices.length; z++) { + for(var z = 0; z < zindices.length; z++) { var newSubplotData = []; for(i = 0; i < len; i++) { newSubplotData[i] = initialSubplotData[i].slice(); @@ -532,9 +532,9 @@ function makeSubplotData(gd) { var d = []; - for(var z = 1; z <= numZ; z++) { + for(var z = 0; z <= numZ; z++) { var zStr = ''; - if(z > 1) zStr += zindexSeparator + z; + if(z > 0) zStr += zindexSeparator + z; // use info about axis layer and overlaying pattern // to clean what need to be cleaned up in exit selection diff --git a/test/image/baselines/zorder-overlayed-subplots-multiple-traces-main-subplot.png b/test/image/baselines/zorder-overlayed-subplots-multiple-traces-main-subplot.png index 5cb4ebb5b11..388bd44ec30 100644 Binary files a/test/image/baselines/zorder-overlayed-subplots-multiple-traces-main-subplot.png and b/test/image/baselines/zorder-overlayed-subplots-multiple-traces-main-subplot.png differ