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

Feature: Plot layout images #525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 12, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Shapes/Images: Reorganize above/below/subplot layers
  • Loading branch information
mdtusz committed May 11, 2016
commit 82c68a207b29bd19d1b30e809e597267da7a6014
4 changes: 2 additions & 2 deletions 4 src/components/shapes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ shapes.drawAll = function(gd) {
// Remove previous shapes before drawing new in shapes in fullLayout.shapes
fullLayout._shapeUpperLayer.selectAll('path').remove();
fullLayout._shapeLowerLayer.selectAll('path').remove();
fullLayout._subplotShapeLayer.selectAll('path').remove();
fullLayout._shapeSubplotLayer.selectAll('path').remove();

for(var i = 0; i < fullLayout.shapes.length; i++) {
shapes.draw(gd, i);
Expand Down Expand Up @@ -356,7 +356,7 @@ function getShapeLayer(gd, index) {
else if(shape.layer === 'below') {
shapeLayer = (shape.xref === 'paper' && shape.yref === 'paper') ?
gd._fullLayout._shapeLowerLayer :
gd._fullLayout._subplotShapeLayer;
gd._fullLayout._shapeSubplotLayer;
}

return shapeLayer;
Expand Down
23 changes: 17 additions & 6 deletions 23 src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2646,6 +2646,8 @@ function makePlotFramework(gd) {
.classed('layer-below', true);
fullLayout._shapeLowerLayer = layerBelow.append('g')
.classed('shapelayer', true);
fullLayout._imageLowerLayer = layerBelow.append('g')
.classed('imagelayer', true);

var subplots = Plotly.Axes.getSubplots(gd);
if(subplots.join('') !== Object.keys(gd._fullLayout._plots || {}).join('')) {
Expand All @@ -2658,15 +2660,18 @@ function makePlotFramework(gd) {
fullLayout._ternarylayer = fullLayout._paper.append('g').classed('ternarylayer', true);

// shape layers in subplots
fullLayout._subplotShapeLayer = fullLayout._paper
.selectAll('.shapelayer-subplot');
var layerSubplot = fullLayout._paper.selectAll('.layer-subplot');
fullLayout._shapeSubplotLayer = layerSubplot.selectAll('.shapelayer');
fullLayout._imageSubplotLayer = layerSubplot.selectAll('.imagelayer');

// upper shape layer
// (only for shapes to be drawn above the whole plot, including subplots)
var layerAbove = fullLayout._paper.append('g')
.classed('layer-above', true);
fullLayout._shapeUpperLayer = layerAbove.append('g')
.classed('shapelayer', true);
fullLayout._imageUpperLayer = layerAbove.append('g')
.classed('imagelayer', true);

// single pie layer for the whole plot
fullLayout._pielayer = fullLayout._paper.append('g').classed('pielayer', true);
Expand Down Expand Up @@ -2797,10 +2802,16 @@ function makeCartesianPlotFramwork(gd, subplots) {
// the plot and containers for overlays
plotinfo.bg = plotgroup.append('rect')
.style('stroke-width', 0);
// shape layer
// (only for shapes to be drawn below a subplot)
plotinfo.shapelayer = plotgroup.append('g')
.classed('shapelayer shapelayer-subplot', true);

// back layer for shapes and images to
// be drawn below a subplot
var backlayer = plotgroup.append('g')
.classed('layer-subplot', true);

plotinfo.shapelayer = backlayer.append('g')
.classed('shapelayer', true);
plotinfo.imagelayer = backlayer.append('g')
.classed('imagelayer', true);
plotinfo.gridlayer = plotgroup.append('g');
plotinfo.overgrid = plotgroup.append('g');
plotinfo.zerolinelayer = plotgroup.append('g');
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.