10000 Faster trace visibility toggling by etpinard · Pull Request #2837 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Faster trace visibility toggling #2837

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

Closed
wants to merge 9 commits into from
Closed
Prev Previous commit
Next Next commit
add a few comments
  • Loading branch information
etpinard committed Jul 23, 2018
commit f1f06f4a1642b542405da4e6e5e2793da086e4cd
2 changes: 1 addition & 1 deletion src/plots/cartesian/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function plotOne(gd, plotinfo, cdSubplot, transitionOpts, makeOnCompleteCallback
var className = (_module.layerName || name + 'layer');
var plotMethod = _module.plot;

// plot all traces of this type on this subplot at once
// plot all visible traces of this type on this subplot at once
cdModuleAndOthers = getModuleCalcData(cdSubplot, plotMethod);
cdModule = cdModuleAndOthers[0];
// don't need to search the found traces again - in fact we need to NOT
Expand Down
1 change: 1 addition & 0 deletions src/plots/get_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ exports.getModuleCalcData = function(calcdata, arg1) {
for(var i = 0; i < calcdata.length; i++) {
var cd = calcdata[i];
var trace = cd[0].trace;
// N.B. 'legendonly' traces do not make it pass here
if(trace.visible !== true) continue;

// group calcdata trace not by 'module' (as the name of this function
Expand Down
5 changes: 5 additions & 0 deletions src/traces/scattergl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,10 @@ function plot(gd, subplot, cdata) {
}

// precalculate px coords since we are not going to pan during select
// TODO, could do better here e.g.
// - spin that in a webworker
// - compute selection from polygons in data coordinates
// (maybe just for linear axes)
var xpx = stash.xpx = new Array(stash.count);
var ypx = stash.ypx = new Array(stash.count);
for(j = 0; j < stash.count; j++) {
Expand Down Expand Up @@ -614,6 +618,7 @@ function plot(gd, subplot, cdata) {
// provide viewport and range
var vpRange0 = {
viewport: getViewport(fullLayout, xaxis, yaxis),
// TODO do we need those fallbacks?
range: [
(xaxis._rl || xaxis.range)[0],
(yaxis._rl || yaxis.range)[0],
Expand Down
0