-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Even better cartesian trace updates and removal #2579
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
Changes from 1 commit
400bfe6
284c206
da63ed4
a1c76bc
fa38ca5
48ee0d8
362da1f
3bef9a9
d47276f
83422f7
8c9a7bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -9,6 +9,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
'use strict'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var d3 = require('d3'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var tinycolor = require('tinycolor2'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var Registry = require('../../registry'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -18,32 +19,28 @@ var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var maxRowLength = require('./max_row_length'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
module.exports = function(gd, plotinfo, cdheatmaps) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for(var i = 0; i < cdheatmaps.length; i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
plotOne(gd, plotinfo, cdheatmaps[i]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
heatmapLayer.selectAll('.hm > image').each(function(d) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var oldTrace = d.trace || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when is there no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when a heatmap trace is completely off screen: plotly.js/src/traces/heatmap/plot.js Lines 138 to 142 in bab2a5b
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a big deal, but wouldn't an off-screen heatmap just not contribute to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removing that plotly.js/test/jasmine/tests/heatmap_test.js Lines 482 to 506 in c0b38da
fail with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... I didn't investigate further. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, not what my quick glance at the code suggested but you're right, no need to dig in any further. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for(i = 0; i < cdheatmaps.length; i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if(oldTrace.uid === cdheatmaps[i][0].trace.uid) return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
d3.select(this.parentNode).remove(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for(i = 0; i < cdheatmaps.length; i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
plotOne(gd, plotinfo, cdheatmaps[i], heatmapLayer); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
function plotOne(gd, plotinfo, cd, heatmapLayer) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var cd0 = cd[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var trace = cd0.trace; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var uid = trace.uid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var xa = plotinfo.xaxis; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var ya = plotinfo.yaxis; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var fullLayout = gd._fullLayout; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var id = 'hm' + uid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// in case this used to be a contour map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fullLayout._paper.selectAll('.contour' + uid).remove(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fullLayout._infolayer.selectAll('g.rangeslider-container') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.selectAll('.contour' + uid).remove(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if(trace.visible !== true) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fullLayout._paper.selectAll('.' + id).remove(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
fullLayout._infolayer.selectAll('.cb' + uid).remove(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var id = 'hm' + trace.uid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var z = cd0.z; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var x = cd0.x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌴 🐎 perhaps make a common helper
getUidsFromCalcdata
or something, that can be called once up front and returns a hash{uid0: 1, uid1: 1, ...}
, thenif(!uidHash[oldUid]) d3.select(this).remove();
?Looks like the same helper would work for all modules in this commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in d47276f