8000 Clean subplots by alexcjohnson · Pull Request #2227 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Clean subplots #2227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jan 3, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
alexcjohnson committed Dec 30, 2017
commit 2aa154537d0902b3fa9d4fb4a58258a76db0345f
22 changes: 11 additions & 11 deletions src/components/annotations/calc_autorange.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ module.exports = function calcAutorange(gd) {

var annotationAxes = {};
annotationList.forEach(function(ann) {
annotationAxes[ann.xref] = true;
annotationAxes[ann.yref] = true;
annotationAxes[ann.xref] = 1;
annotationAxes[ann.yref] = 1;
});

var autorangedAnnos = Axes.list(gd).filter(function(ax) {
return ax.autorange && annotationAxes[ax._id];
});
if(!autorangedAnnos.length) return;

return Lib.syncOrAsync([
draw,
annAutorange
], gd);
for(var axId in annotationAxes) {
var ax = Axes.getFromId(gd, axId);
if(ax.autorange) {
return Lib.syncOrAsync([
draw,
annAutorange
], gd);
}
}
};

function annAutorange(gd) {
Expand Down
30 changes: 15 additions & 15 deletions src/components/modebar/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

var Plotly = require('../../plotly');
var Plots = require('../../plots/plots');
var Axes = require('../../plots/cartesian/axes');
var axisIds = require('../../plots/cartesian/axis_ids');
var Lib = require('../../lib');
var downloadImage = require('../../snapshot/download');
var Icons = require('../../../build/ploticon');
Expand Down Expand Up @@ -175,15 +175,15 @@ modeBarButtons.hoverCompareCartesian = {
};

function handleCartesian(gd, ev) {
var button = ev.currentTarget,
astr = button.getAttribute('data-attr'),
val = button.getAttribute('data-val') || true,
fullLayout = gd._fullLayout,
aobj = {},
axList = Axes.list(gd, null, true),
ax,
allEnabled = 'on',
i;
var button = ev.currentTarget;
var astr = button.getAttribute('data-attr');
var val = button.getAttribute('data-val') || true;
var fullLayout = gd._fullLayout;
var aobj = {};
var axList = axisIds.list(gd, null, true);
var allEnabled = 'on';

var ax, i;

if(astr === 'zoom') {
var mag = (val === 'in') ? 0.5 : 2,
Expand Down Expand Up @@ -562,11 +562,11 @@ modeBarButtons.toggleSpikelines = {
};

function setSpikelineVisibility(gd) {
var fullLayout = gd._fullLayout,
axList = Axes.list(gd, null, true),
ax,
axName,
aobj = {};
var fullLayout = gd._fullLayout;
var axList = axisIds.list(gd, null, true);
var aobj = {};

var ax, axName;

for(var i = 0; i < axList.length; i++) {
ax = axList[i];
Expand Down
10 changes: 4 additions & 6 deletions src/components/modebar/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

'use strict';

var Axes = require('../../plots/cartesian/axes');
var axisIds = require('../../plots/cartesian/axis_ids');
var scatterSubTypes = require('../../traces/scatter/subtypes');
var Registry = require('../../registry');

Expand Down Expand Up @@ -150,17 +150,15 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) {
}

function areAllAxesFixed(fullLayout) {
var axList = Axes.list({_fullLayout: fullLayout}, null, true);
var allFixed = true;
var axList = axisIds.list({_fullLayout: fullLayout}, null, true);

for(var i = 0; i < axList.length; i++) {
if(!axList[i].fixedrange) {
allFixed = false;
break;
return false;
}
}

return allFixed;
return true;
}

// look for traces that support selection
Expand Down
0