Skip to content

Commit 401029a

Browse files
committed
generalize _autoBinFinished for histogram2d
- this fixes some shared histogram2d (via bingroup) edge cases - this fixes a performance regression from #3845
1 parent 6a8baf9 commit 401029a

File tree

6 files changed

+769
-9
lines changed

6 files changed

+769
-9
lines changed

src/plots/plots.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -2961,7 +2961,10 @@ function sortAxisCategoriesByValue(axList, gd) {
29612961
if(fullTrace.visible !== true) continue;
29622962

29632963
var type = fullTrace.type;
2964-
if(Registry.traceIs(fullTrace, 'histogram')) delete fullTrace._autoBinFinished;
2964+
if(Registry.traceIs(fullTrace, 'histogram')) {
2965+
delete fullTrace._xautoBinFinished;
2966+
delete fullTrace._yautoBinFinished;
2967+
}
29652968

29662969
var cd = gd.calcdata[traceIndex];
29672970
for(k = 0; k < cd.length; k++) {

src/traces/histogram/calc.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ function calcAllAutoBins(gd, trace, pa, mainData, _overlayEdgeCase) {
232232

233233
// all but the first trace in this group has already been marked finished
234234
// clear this flag, so next time we run calc we will run autobin again
235-
if(trace._autoBinFinished) {
236-
delete trace._autoBinFinished;
235+
if(trace['_' + mainData + 'autoBinFinished']) {
236+
delete trace['_' + mainData + 'autoBinFinished'];
237237
} else {
238238
traces = binOpts.traces;
239239
var allPos = [];
@@ -253,14 +253,14 @@ function calcAllAutoBins(gd, trace, pa, mainData, _overlayEdgeCase) {
253253
pos0 = tracei['_' + mainDatai + 'pos0'] = pa.makeCalcdata(tracei, mainDatai);
254254

255255
allPos = Lib.concat(allPos, pos0);
256-
delete tracei._autoBinFinished;
256+
delete tracei['_' + mainData + 'autoBinFinished'];
257257

258258
if(trace.visible === true) {
259259
if(isFirstVisible) {
260260
isFirstVisible = false;
261261
} else {
262262
delete tracei._autoBin;
263-
tracei._autoBinFinished = 1;
263+
tracei['_' + mainData + 'autoBinFinished'] = 1;
264264
}
265265
if(Registry.traceIs(tracei, '2dMap')) {
266266
has2dMap = true;
@@ -421,7 +421,7 @@ function handleSingleValueOverlays(gd, trace, pa, mainData, binAttr) {
421421

422422
// so we can use this result when we get to tracei in the normal
423423
// course of events, mark it as done and put _pos0 back
424-
tracei._autoBinFinished = 1;
424+
tracei['_' + mainData + 'autoBinFinished'] = 1;
425425
tracei['_' + mainData + 'pos0'] = resulti[1];
426426

427427
if(isSingleValued) {

src/traces/histogram/cross_trace_defaults.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ module.exports = function crossTraceDefaults(fullData, fullLayout) {
106106

107107
// TODO: this shouldn't be relinked as it's only used within calc
108108
// https://github.com/plotly/plotly.js/issues/749
109-
delete traceOut._autoBinFinished;
109+
delete traceOut._xautoBinFinished;
110+
delete traceOut._yautoBinFinished;
110111

111112
// N.B. need to coerce *alignmentgroup* before *bingroup*, as traces
112113
// in same alignmentgroup "have to match"
Loading

0 commit comments

Comments
 (0)