Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0003e22

Browse filesBrowse files
committed
split doCalcdata operation into different loops:
- one loop for relinking calcdata - one loop for transform ops - one loop for regular _module.calc in an effort to make transform less intrusive.
1 parent b823573 commit 0003e22
Copy full SHA for 0003e22

File tree

Expand file treeCollapse file tree

1 file changed

+29
-29
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+29
-29
lines changed

‎src/plots/plots.js

Copy file name to clipboardExpand all lines: src/plots/plots.js
+29-29Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,8 +1921,9 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts)
19211921
plots.doCalcdata = function(gd, traces) {
19221922
var axList = Plotly.Axes.list(gd),
19231923
fullData = gd._fullData,
1924-
fullLayout = gd._fullLayout,
1925-
i, j;
1924+
fullLayout = gd._fullLayout;
1925+
1926+
var trace, _module, i, j;
19261927

19271928
// XXX: Is this correct? Needs a closer look so that *some* traces can be recomputed without
19281929
// *all* needing doCalcdata:
@@ -1951,46 +1952,45 @@ plots.doCalcdata = function(gd, traces) {
19511952
axList[i]._categories = axList[i]._initialCategories.slice();
19521953
}
19531954

1955+
// If traces were specified and this trace was not included,
1956+
// then transfer it over from the old calcdata:
19541957
for(i = 0; i < fullData.length; i++) {
1955-
// If traces were specified and this trace was not included, then transfer it over from
1956-
// the old calcdata:
1957-
if(Array.isArray(traces) && traces.indexOf(i) === -1) {
1958-
calcdata[i] = oldCalcdata[i];
1959-
continue;
1960-
}
1961-
1962-
var trace = fullData[i],
1963-
cd = [];
1964-
1965-
// If traces were specified and this trace was not included, then transfer it over from
1966-
// the old calcdata:
19671958
if(Array.isArray(traces) && traces.indexOf(i) === -1) {
19681959
calcdata[i] = oldCalcdata[i];
19691960
continue;
19701961
}
1962+
}
19711963

1972-
var _module;
1973-
if(trace.visible === true) {
1964+
// transform loop
1965+
for(i = 0; i < fullData.length; i++) {
1966+
trace = fullData[i];
19741967

1975-
// call calcTransform method if any
1976-
if(trace.transforms) {
1968+
if(trace.visible === true && trace.transforms) {
1969+
_module = trace._module;
19771970

1978-
// we need one round of trace module calc before
1979-
// the calc transform to 'fill in' the categories list
1980-
// used for example in the data-to-coordinate method
1981-
_module = trace._module;
1982-
if(_module && _module.calc) _module.calc(gd, trace);
1971+
// we need one round of trace module calc before
1972+
// the calc transform to 'fill in' the categories list
1973+
// used for example in the data-to-coordinate method
1974+
if(_module && _module.calc) _module.calc(gd, trace);
19831975

1984-
for(j = 0; j < trace.transforms.length; j++) {
1985-
var transform = trace.transforms[j];
1976+
for(j = 0; j < trace.transforms.length; j++) {
1977+
var transform = trace.transforms[j];
19861978

1987-
_module = transformsRegistry[transform.type];
1988-
if(_module && _module.calcTransform) {
1989-
_module.calcTransform(gd, trace, transform);
1990-
}
1979+
_module = transformsRegistry[transform.type];
1980+
if(_module && _module.calcTransform) {
1981+
_module.calcTransform(gd, trace, transform);
19911982
}
19921983
}
1984+
}
1985+
}
19931986

1987+
// 'regular' loop
1988+
for(i = 0; i < fullData.length; i++) {
1989+
var cd = [];
1990+
1991+
trace = fullData[i];
1992+
1993+
if(trace.visible === true) {
19941994
_module = trace._module;
19951995
if(_module && _module.calc) cd = _module.calc(gd, trace);
19961996
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.