8000 Optimize performance of setCategoryIndex by hy9be · Pull Request #1544 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Optimize performance of setCategoryIndex #1544

N 8000 ew 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 13 commits into from
Apr 10, 2017
Merged
8 changes: 4 additions & 4 deletions src/traces/scatter/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ module.exports = function plot(gd, plotinfo, cdscatter, transitionOpts, makeOnCo
// Sort the traces, once created, so that the ordering is preserved even when traces
// are shown and hidden. This is needed since we're not just wiping everything out
// and recreating on every update.
for(i = 0, uids = []; i < cdscatter.length; i++) {
uids[i] = cdscatter[i][0].trace.uid;
for(i = 0, uids = {}; i < cdscatter.length; i++) {
uids[cdscatter[i][0].trace.uid] = i;
}

scatterlayer.selectAll('g.trace').sort(function(a, b) {
var idx1 = uids.indexOf(a[0].trace.uid);
var idx2 = uids.indexOf(b[0].trace.uid);
var idx1 = uids[a[0].trace.uid];
var idx2 = uids[b[0].trace.uid];
return idx1 > idx2 ? 1 : -1;
});

Expand Down
0