Skip to content

Commit 6b34ae3

Browse files
committed
use ax._matchGroup to improve matching axes relayout perf
1 parent d0581e2 commit 6b34ae3

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

src/plot_api/plot_api.js

+7-13
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,6 @@ exports.relayout = relayout;
19331933
// Plots.supplyDefaults can take > 100ms
19341934
function axRangeSupplyDefaultsByPass(gd, flags, specs) {
19351935
var fullLayout = gd._fullLayout;
1936-
var axisMatchGroups = fullLayout._axisMatchGroups || [];
19371936

19381937
if(!flags.axrange) return false;
19391938

@@ -1949,10 +1948,9 @@ function axRangeSupplyDefaultsByPass(gd, flags, specs) {
19491948
axOut.range = axIn.range.slice();
19501949
axOut.cleanRange();
19511950

1952-
for(var i = 0; i < axisMatchGroups.length; i++) {
1953-
var group = axisMatchGroups[i];
1954-
if(group[axId]) {
1955-
for(var axId2 in group) {
1951+
if(axOut._matchGroup) {
1952+
for(var axId2 in axOut._matchGroup) {
1953+
if(axId2 !== axId) {
19561954
var ax2 = fullLayout[Axes.id2name(axId2)];
19571955
ax2.autorange = axOut.autorange;
19581956
ax2.range = axOut.range.slice();
@@ -1973,19 +1971,15 @@ function addAxRangeSequence(seq, rangesAltered) {
19731971
function(gd) {
19741972
var axIds = [];
19751973
var skipTitle = true;
1976-
var matchGroups = gd._fullLayout._axisMatchGroups || [];
19771974

19781975
for(var id in rangesAltered) {
19791976
var ax = Axes.getFromId(gd, id);
19801977
axIds.push(id);
19811978

1982-
for(var i = 0; i < matchGroups.length; i++) {
1983-
var group = matchGroups[i];
1984-
if(group[id]) {
1985-
for(var id2 in group) {
1986-
if(!rangesAltered[id2]) {
1987-
axIds.push(id2);
1988-
}
1979+
if(ax._matchGroup) {
1980+
for(var id2 in ax._matchGroup) {
1981+
if(!rangesAltered[id2]) {
1982+
axIds.push(id2);
19891983
}
19901984
}
19911985
}

src/plots/cartesian/layout_defaults.js

+1
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
296296
axLayoutOut.range = rng.slice();
297297
axLayoutOut.autorange = autorange;
298298
}
299+
axLayoutOut._matchGroup = group;
299300
}
300301
}
301302
};

0 commit comments

Comments
 (0)