Skip to content

Commit ee1adf8

Browse files
committed
call PlotSchema.findArrayAttributes in doCalcdata
- no need to call on every update, when data array change is sufficient. - note that the groupby transform still need to call Plots.findArrayAttributes on its own as its transform method is called during the defaults.
1 parent 129ad6c commit ee1adf8

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/plots/plots.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ plots.supplyDefaults = function(gd) {
521521

522522
function remapTransformedArrays(cd0, newTrace) {
523523
var oldTrace = cd0.trace;
524-
var arrayAttrs = PlotSchema.findArrayAttributes(oldTrace);
524+
var arrayAttrs = oldTrace._arrayAttrs;
525525
var transformedArrayHash = {};
526526
var i, astr;
527527

@@ -676,9 +676,6 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {
676676
Lib.pushUnique(modules, _module);
677677
Lib.pushUnique(basePlotModules, fullTrace._module.basePlotModule);
678678

679-
// TODO remove findArrayAttributes calls downstream
680-
fullTrace._arrayAttrs = PlotSchema.findArrayAttributes(fullTrace);
681-
682679
cnt++;
683680
}
684681

@@ -2038,6 +2035,12 @@ plots.doCalcdata = function(gd, traces) {
20382035
}
20392036
}
20402037

2038+
// find array attributes in trace
2039+
for(i = 0; i < fullData.length; i++) {
2040+
trace = fullData[i];
2041+
trace._arrayAttrs = PlotSchema.findArrayAttributes(trace);
2042+
}
2043+
20412044
initCategories(axList);
20422045

20432046
var hasCalcTransform = false;

src/transforms/filter.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
var Lib = require('../lib');
1212
var Registry = require('../registry');
13-
var PlotSchema = require('../plot_api/plot_schema');
1413
var Axes = require('../plots/cartesian/axes');
1514

1615
var COMPARISON_OPS = ['=', '!=', '<', '>=', '>', '<='];
@@ -148,6 +147,7 @@ exports.calcTransform = function(gd, trace, opts) {
148147
var target = opts.target;
149148
var len = targetArray.length;
150149
var targetCalendar = opts.targetcalendar;
150+
var arrayAttrs = trace._arrayAttrs;
151151

152152
// even if you provide targetcalendar, if target is a string and there
153153
// is a calendar attribute matching target it will get used instead.
@@ -158,7 +158,6 @@ exports.calcTransform = function(gd, trace, opts) {
158158

159159
var d2c = Axes.getDataToCoordFunc(gd, trace, target, targetArray);
160160
var filterFunc = getFilterFunc(opts, d2c, targetCalendar);
161-
var arrayAttrs = PlotSchema.findArrayAttributes(trace);
162161
var originalArrays = {};
163162

164163
function forAllAttrs(fn, index) {

src/transforms/sort.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
'use strict';
1010

1111
var Lib = require('../lib');
12-
var PlotSchema = require('../plot_api/plot_schema');
1312
var Axes = require('../plots/cartesian/axes');
1413

1514
exports.moduleType = 'transform';
@@ -78,7 +77,7 @@ exports.calcTransform = function(gd, trace, opts) {
7877

7978
var target = opts.target;
8079
var len = targetArray.length;
81-
var arrayAttrs = PlotSchema.findArrayAttributes(trace);
80+
var arrayAttrs = trace._arrayAttrs;
8281
var d2c = Axes.getDataToCoordFunc(gd, trace, target, targetArray);
8382
var indices = getIndices(opts, targetArray, d2c);
8483

0 commit comments

Comments
 (0)