8000 Set key function for layout images by alexcjohnson · Pull Request #7277 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Set key function for layout images #7277

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 21, 2024
Merged
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
Prev Previous commit
Next Next commit
ensure images stay sorted properly with the new data key
  • Loading branch information
alexcjohnson committed Nov 20, 2024
commit e18ffd6b2b32a9ef01f912582cfb0b15725dc67c
4 changes: 4 additions & 0 deletions src/components/images/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ module.exports = function draw(gd) {
return [d.xref, d.x, d.sizex, d.yref, d.y, d.sizey].join('_');
}

function imgSort(a, b) { return a._index - b._index; }

var imagesBelow = fullLayout._imageLowerLayer.selectAll('image')
.data(imageDataBelow, imgDataFunc);
var imagesAbove = fullLayout._imageUpperLayer.selectAll('image')
Expand All @@ -226,6 +228,8 @@ module.exports = function draw(gd) {
setImage.bind(this)(d);
applyAttributes.bind(this)(d);
});
imagesBelow.sort(imgSort);
imagesAbove.sort(imgSort);

var allSubplots = Object.keys(fullLayout._plots);
for(i = 0; i < allSubplots.length; i++) {
Expand Down
0