Skip to content

Mulitple fixes for multi-heatmap-trace plots #655

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
Jun 20, 2016
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
26 changes: 16 additions & 10 deletions src/traces/heatmap/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,24 @@ function plotOne(gd, plotinfo, cd) {
var imageWidth = Math.round(right - left),
imageHeight = Math.round(bottom - top);

// now redraw
// setup image nodes

// if image is entirely off-screen, don't even draw it
if(imageWidth <= 0 || imageHeight <= 0) return;
var isOffScreen = (imageWidth <= 0 || imageHeight <= 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heatmap.plot was returning early for off screen traces, but did not clear the exiting nodes.


var plotgroup = plotinfo.plot.select('.imagelayer')
.selectAll('g.hm.' + id)
.data(isOffScreen ? [] : [0]);

plotgroup.enter().append('g')
.classed('hm', true)
.classed(id, true);

plotgroup.exit().remove();

if(isOffScreen) return;

// generate image data

var canvasW, canvasH;
if(zsmooth === 'fast') {
Expand Down Expand Up @@ -363,14 +377,6 @@ function plotOne(gd, plotinfo, cd) {
gd._hmpixcount = (gd._hmpixcount||0) + pixcount;
gd._hmlumcount = (gd._hmlumcount||0) + pixcount * avgColor.getLuminance();

var plotgroup = plotinfo.plot.select('.imagelayer')
.selectAll('g.hm.' + id)
.data([0]);
plotgroup.enter().append('g')
.classed('hm', true)
.classed(id, true);
plotgroup.exit().remove();

var image3 = plotgroup.selectAll('image')
.data(cd);

Expand Down