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 2aa1545

Browse filesBrowse files
committed
simplify and speed up a few Axes.list uses
in particular, annotations autorange was including 3d axes, and axes we already knew didn't have annotations.
1 parent 0506f88 commit 2aa1545
Copy full SHA for 2aa1545

File tree

Expand file treeCollapse file tree

3 files changed

+30
-32
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+30
-32
lines changed

‎src/components/annotations/calc_autorange.js

Copy file name to clipboardExpand all lines: src/components/annotations/calc_autorange.js
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ module.exports = function calcAutorange(gd) {
2323

2424
var annotationAxes = {};
2525
annotationList.forEach(function(ann) {
26-
annotationAxes[ann.xref] = true;
27-
annotationAxes[ann.yref] = true;
26+
annotationAxes[ann.xref] = 1;
27+
annotationAxes[ann.yref] = 1;
2828
});
2929

30-
var autorangedAnnos = Axes.list(gd).filter(function(ax) {
31-
return ax.autorange && annotationAxes[ax._id];
32-
});
33-
if(!autorangedAnnos.length) return;
34-
35-
return Lib.syncOrAsync([
36-
draw,
37-
annAutorange
38-
], gd);
30+
for(var axId in annotationAxes) {
31+
var ax = Axes.getFromId(gd, axId);
32+
if(ax.autorange) {
33+
return Lib.syncOrAsync([
34+
draw,
35+
annAutorange
36+
], gd);
37+
}
38+
}
3939
};
4040

4141
function annAutorange(gd) {

‎src/components/modebar/buttons.js

Copy file name to clipboardExpand all lines: src/components/modebar/buttons.js
+15-15Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
var Plotly = require('../../plotly');
1313
var Plots = require('../../plots/plots');
14-
var Axes = require('../../plots/cartesian/axes');
14+
var axisIds = require('../../plots/cartesian/axis_ids');
1515
var Lib = require('../../lib');
1616
var downloadImage = require('../../snapshot/download');
1717
var Icons = require('../../../build/ploticon');
@@ -175,15 +175,15 @@ modeBarButtons.hoverCompareCartesian = {
175175
};
176176

177177
function handleCartesian(gd, ev) {
178-
var button = ev.currentTarget,
179-
astr = button.getAttribute('data-attr'),
180-
val = button.getAttribute('data-val') || true,
181-
fullLayout = gd._fullLayout,
182-
aobj = {},
183-
axList = Axes.list(gd, null, true),
184-
ax,
185-
allEnabled = 'on',
186-
i;
178+
var button = ev.currentTarget;
179+
var astr = button.getAttribute('data-attr');
180+
var val = button.getAttribute('data-val') || true;
181+
var fullLayout = gd._fullLayout;
182+
var aobj = {};
183+
var axList = axisIds.list(gd, null, true);
184+
var allEnabled = 'on';
185+
186+
var ax, i;
187187

188188
if(astr === 'zoom') {
189189
var mag = (val === 'in') ? 0.5 : 2,
@@ -562,11 +562,11 @@ modeBarButtons.toggleSpikelines = {
562562
};
563563

564564
function setSpikelineVisibility(gd) {
565-
var fullLayout = gd._fullLayout,
566-
axList = Axes.list(gd, null, true),
567-
ax,
568-
axName,
569-
aobj = {};
565+
var fullLayout = gd._fullLayout;
566+
var axList = axisIds.list(gd, null, true);
567+
var aobj = {};
568+
569+
var ax, axName;
570570

571571
for(var i = 0; i < axList.length; i++) {
572572
ax = axList[i];

‎src/components/modebar/manage.js

Copy file name to clipboardExpand all lines: src/components/modebar/manage.js
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
'use strict';
1111

12-
var Axes = require('../../plots/cartesian/axes');
12+
var axisIds = require('../../plots/cartesian/axis_ids');
1313
var scatterSubTypes = require('../../traces/scatter/subtypes');
1414
var Registry = require('../../registry');
1515

@@ -150,17 +150,15 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) {
150150
}
151151

152152
function areAllAxesFixed(fullLayout) {
153-
var axList = Axes.list({_fullLayout: fullLayout}, null, true);
154-
var allFixed = true;
153+
var axList = axisIds.list({_fullLayout: fullLayout}, null, true);
155154

156155
for(var i = 0; i < axList.length; i++) {
157156
if(!axList[i].fixedrange) {
158-
allFixed = false;
159-
break;
157+
return false;
160158
}
161159
}
162160

163-
return allFixed;
161+
return true;
164162
}
165163

166164
// look for traces that support selection

0 commit comments

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