Skip to content

Commit 2b05978

Browse files
committed
replace plotinfo.x() -> plotinfo.x()
1 parent b00d716 commit 2b05978

File tree

16 files changed

+57
-62
lines changed

16 files changed

+57
-62
lines changed

src/components/errorbars/plot.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ var subTypes = require('../../traces/scatter/subtypes');
1616

1717
module.exports = function plot(traces, plotinfo, transitionOpts) {
1818
var isNew;
19-
var xa = plotinfo.x(),
20-
ya = plotinfo.y();
19+
20+
var xa = plotinfo.xaxis,
21+
ya = plotinfo.yaxis;
2122

2223
var hasAnimation = transitionOpts && transitionOpts.duration > 0;
2324

src/plots/cartesian/axes.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1373,8 +1373,8 @@ axes.doTicks = function(gd, axid, skipTitle) {
13731373
if(axid === 'redraw') {
13741374
fullLayout._paper.selectAll('g.subplot').each(function(subplot) {
13751375
var plotinfo = fullLayout._plots[subplot],
1376-
xa = plotinfo.x(),
1377-
ya = plotinfo.y();
1376+
xa = plotinfo.xaxis,
1377+
ya = plotinfo.yaxis;
13781378

13791379
plotinfo.xaxislayer
13801380
.selectAll('.' + xa._id + 'tick').remove();
@@ -1837,7 +1837,7 @@ axes.doTicks = function(gd, axid, skipTitle) {
18371837

18381838
// [bottom or left, top or right, free, main]
18391839
linepositions = ax._linepositions[subplot] || [],
1840-
counteraxis = plotinfo[counterLetter](),
1840+
counteraxis = plotinfo[counterLetter + 'axis'],
18411841
mainSubplot = counteraxis._id === ax.anchor,
18421842
ticksides = [false, false, false],
18431843
tickpath = '';

src/plots/cartesian/dragbox.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
4848
var fullLayout = gd._fullLayout,
4949
// if we're dragging two axes at once, also drag overlays
5050
subplots = [plotinfo].concat((ns && ew) ? plotinfo.overlays : []),
51-
xa = [plotinfo.x()],
52-
ya = [plotinfo.y()],
51+
xa = [plotinfo.xaxis],
52+
ya = [plotinfo.yaxis],
5353
pw = xa[0]._length,
5454
ph = ya[0]._length,
5555
MINDRAG = constants.MINDRAG,
5656
MINZOOM = constants.MINZOOM,
5757
isMainDrag = (ns + ew === 'nsew');
5858

5959
for(var i = 1; i < subplots.length; i++) {
60-
var subplotXa = subplots[i].x(),
61-
subplotYa = subplots[i].y();
60+
var subplotXa = subplots[i].xaxis,
61+
subplotYa = subplots[i].yaxis;
6262
if(xa.indexOf(subplotXa) === -1) xa.push(subplotXa);
6363
if(ya.indexOf(subplotYa) === -1) ya.push(subplotYa);
6464
}
@@ -146,8 +146,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
146146
dragElement.init(dragOptions);
147147

148148
var zoomlayer = gd._fullLayout._zoomlayer,
149-
xs = plotinfo.x()._offset,
150-
ys = plotinfo.y()._offset,
149+
xs = plotinfo.xaxis._offset,
150+
ys = plotinfo.yaxis._offset,
151151
x0,
152152
y0,
153153
box,
@@ -159,23 +159,23 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
159159
corners;
160160

161161
function recomputeAxisLists() {
162-
xa = [plotinfo.x()];
163-
ya = [plotinfo.y()];
162+
xa = [plotinfo.xaxis];
163+
ya = [plotinfo.yaxis];
164164
pw = xa[0]._length;
165165
ph = ya[0]._length;
166166

167167
for(var i = 1; i < subplots.length; i++) {
168-
var subplotXa = subplots[i].x(),
169-
subplotYa = subplots[i].y();
168+
var subplotXa = subplots[i].xaxis,
169+
subplotYa = subplots[i].yaxis;
170170
if(xa.indexOf(subplotXa) === -1) xa.push(subplotXa);
171171
if(ya.indexOf(subplotYa) === -1) ya.push(subplotYa);
172172
}
173173
allaxes = xa.concat(ya);
174174
xActive = isDirectionActive(xa, ew);
175175
yActive = isDirectionActive(ya, ns);
176176
cursor = getDragCursor(yActive + xActive, fullLayout.dragmode);
177-
xs = plotinfo.x()._offset;
178-
ys = plotinfo.y()._offset;
177+
xs = plotinfo.xaxis._offset;
178+
ys = plotinfo.yaxis._offset;
179179
dragOptions.xa = xa;
180180
dragOptions.ya = ya;
181181
}
@@ -656,8 +656,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
656656
for(var i = 0; i < subplots.length; i++) {
657657

658658
var subplot = plotinfos[subplots[i]],
659-
xa2 = subplot.x(),
660-
ya2 = subplot.y(),
659+
xa2 = subplot.xaxis,
660+
ya2 = subplot.yaxis,
661661
editX = ew && !xa2.fixedrange,
662662
editY = ns && !ya2.fixedrange;
663663

src/plots/cartesian/graph_interact.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ fx.init = function(gd) {
109109

110110
if(!fullLayout._has('cartesian')) return;
111111

112-
var xa = plotinfo.x(),
113-
ya = plotinfo.y(),
112+
var xa = plotinfo.xaxis,
113+
ya = plotinfo.yaxis,
114114

115115
// the y position of the main x axis line
116116
y0 = (xa._linepositions[subplot] || [])[3],

src/plots/cartesian/select.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ function getAxId(ax) { return ax._id; }
2424
module.exports = function prepSelect(e, startX, startY, dragOptions, mode) {
2525
var plot = dragOptions.gd._fullLayout._zoomlayer,
2626
dragBBox = dragOptions.element.getBoundingClientRect(),
27-
xs = dragOptions.plotinfo.x()._offset,
28-
ys = dragOptions.plotinfo.y()._offset,
27+
xs = dragOptions.plotinfo.xaxis._offset,
28+
ys = dragOptions.plotinfo.yaxis._offset,
2929
x0 = startX - dragBBox.left,
3030
y0 = startY - dragBBox.top,
3131
x1 = x0,

src/plots/cartesian/transition_axes.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo
134134
}
135135

136136
function unsetSubplotTransform(subplot) {
137-
var xa2 = subplot.x();
138-
var ya2 = subplot.y();
137+
var xa2 = subplot.xaxis;
138+
var ya2 = subplot.yaxis;
139139

140140
fullLayout._defs.selectAll('#' + subplot.clipId)
141141
.call(Lib.setTranslate, 0, 0)
@@ -194,11 +194,11 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo
194194
viewBox[3] = subplot.yaxis._length;
195195
}
196196

197-
ticksAndAnnotations(subplot.x(), subplot.y());
197+
ticksAndAnnotations(subplot.xaxis, subplot.yaxis);
198198

199199

200-
var xa2 = subplot.x();
201-
var ya2 = subplot.y();
200+
var xa2 = subplot.xaxis;
201+
var ya2 = subplot.yaxis;
202202

203203
var editX = !!xUpdate;
204204
var editY = !!yUpdate;

src/plots/plots.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -573,10 +573,6 @@ plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLa
573573

574574
var ids = Plotly.Axes.getSubplots(mockGd);
575575

576-
function getAxisFunc(subplot, axLetter) {
577-
return function() { return Plotly.Axes.getFromId(mockGd, subplot, axLetter); };
578-
}
579-
580576
for(var i = 0; i < ids.length; i++) {
581577
var id = ids[i],
582578
oldSubplot = oldSubplots[id],
@@ -590,10 +586,8 @@ plots.linkSubplots = function(newFullData, newFullLayout, oldFullData, oldFullLa
590586
plotinfo.id = id;
591587
}
592588

593-
plotinfo.x = getAxisFunc(id, 'x');
594-
plotinfo.y = getAxisFunc(id, 'y');
595-
plotinfo.xaxis = plotinfo.x();
596-
plotinfo.yaxis = plotinfo.y();
589+
plotinfo.xaxis = Plotly.Axes.getFromId(mockGd, id, 'x');
590+
plotinfo.yaxis = Plotly.Axes.getFromId(mockGd, id, 'y');
597591
}
598592
};
599593

src/traces/bar/plot.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ var arraysToCalcdata = require('./arrays_to_calcdata');
2020

2121

2222
module.exports = function plot(gd, plotinfo, cdbar) {
23-
var xa = plotinfo.x(),
24-
ya = plotinfo.y(),
23+
var xa = plotinfo.xaxis,
24+
ya = plotinfo.yaxis,
2525
fullLayout = gd._fullLayout;
2626

2727
var bartraces = plotinfo.plot.select('.barlayer')

src/traces/bar/set_positions.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ var Lib = require('../../lib');
2424

2525
module.exports = function setPositions(gd, plotinfo) {
2626
var fullLayout = gd._fullLayout,
27-
xa = plotinfo.x(),
28-
ya = plotinfo.y(),
27+
xa = plotinfo.xaxis,
28+
ya = plotinfo.yaxis,
2929
i, j;
3030

3131
['v', 'h'].forEach(function(dir) {
3232
var bl = [],
3333
pLetter = {v: 'x', h: 'y'}[dir],
3434
sLetter = {v: 'y', h: 'x'}[dir],
35-
pa = plotinfo[pLetter](),
36-
sa = plotinfo[sLetter]();
35+
pa = plotinfo[pLetter + 'axis'],
36+
sa = plotinfo[sLetter + 'axis'];
3737

3838
gd._fullData.forEach(function(trace, i) {
3939
if(trace.visible === true &&

src/traces/box/plot.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ var JITTERCOUNT = 5, // points either side of this to include
3737

3838
module.exports = function plot(gd, plotinfo, cdbox) {
3939
var fullLayout = gd._fullLayout,
40-
xa = plotinfo.x(),
41-
ya = plotinfo.y(),
40+
xa = plotinfo.xaxis,
41+
ya = plotinfo.yaxis,
4242
posAxis, valAxis;
4343

4444
var boxtraces = plotinfo.plot.select('.boxlayer')

src/traces/box/set_positions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ var Lib = require('../../lib');
1515

1616
module.exports = function setPositions(gd, plotinfo) {
1717
var fullLayout = gd._fullLayout,
18-
xa = plotinfo.x(),
19-
ya = plotinfo.y(),
18+
xa = plotinfo.xaxis,
19+
ya = plotinfo.yaxis,
2020
orientations = ['v', 'h'];
2121
var posAxis, i, j, k;
2222

src/traces/contour/plot.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ function plotOne(gd, plotinfo, cd) {
5656
y = cd[0].y,
5757
contours = trace.contours,
5858
uid = trace.uid,
59-
xa = plotinfo.x(),
60-
ya = plotinfo.y(),
59+
xa = plotinfo.xaxis,
60+
ya = plotinfo.yaxis,
6161
fullLayout = gd._fullLayout,
6262
id = 'contour' + uid,
6363
pathinfo = emptyPathinfo(contours, plotinfo, cd[0]);
@@ -120,8 +120,8 @@ function emptyPathinfo(contours, plotinfo, cd0) {
120120
// all closed paths
121121
paths: [],
122122
// store axes so we can convert to px
123-
xaxis: plotinfo.x(),
124-
yaxis: plotinfo.y(),
123+
xaxis: plotinfo.xaxis,
124+
yaxis: plotinfo.yaxis,
125125
// full data arrays to use for interpolation
126126
x: cd0.x,
127127
y: cd0.y,
@@ -662,8 +662,8 @@ function clipGaps(plotGroup, plotinfo, cd0, perimeter) {
662662
starts: [],
663663
edgepaths: [],
664664
paths: [],
665-
xaxis: plotinfo.x(),
666-
yaxis: plotinfo.y(),
665+
xaxis: plotinfo.xaxis,
666+
yaxis: plotinfo.yaxis,
667667
x: cd0.x,
668668
y: cd0.y,
669669
// 0 = no data, 1 = data

src/traces/heatmap/plot.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ module.exports = function(gd, plotinfo, cdheatmaps) {
3030
function plotOne(gd, plotinfo, cd) {
3131
var trace = cd[0].trace,
3232
uid = trace.uid,
33-
xa = plotinfo.x(),
34-
ya = plotinfo.y(),
33+
xa = plotinfo.xaxis,
34+
ya = plotinfo.yaxis,
3535
fullLayout = gd._fullLayout,
3636
id = 'hm' + uid;
3737

src/traces/scatter/plot.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
156156
return hasTransition ? selection.transition() : selection;
157157
}
158158

159-
var xa = plotinfo.x(),
160-
ya = plotinfo.y();
159+
var xa = plotinfo.xaxis,
160+
ya = plotinfo.yaxis;
161161

162162
var trace = cdscatter[0].trace,
163163
line = trace.line,
@@ -479,8 +479,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
479479
}
480480

481481
function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) {
482-
var xa = plotinfo.x(),
483-
ya = plotinfo.y(),
482+
var xa = plotinfo.xaxis,
483+
ya = plotinfo.yaxis,
484484
xr = d3.extent(xa.range.map(xa.l2c)),
485485
yr = d3.extent(ya.range.map(ya.l2c));
486486

src/traces/scatterternary/plot.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ module.exports = function plot(ternary, data) {
2020

2121
// mimic cartesian plotinfo
2222
var plotinfo = {
23-
x: function() { return ternary.xaxis; },
24-
y: function() { return ternary.yaxis; },
23+
xaxis: ternary.xaxis,
24+
yaxis: ternary.yaxis,
2525
plot: plotContainer
2626
};
2727

test/jasmine/tests/bar_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ describe('heatmap calc / setPositions', function() {
9393
});
9494

9595
var plotinfo = {
96-
x: function() { return gd._fullLayout.xaxis; },
97-
y: function() { return gd._fullLayout.yaxis; }
96+
xaxis: gd._fullLayout.xaxis,
97+
yaxis: gd._fullLayout.yaxis
9898
};
9999

100100
Bar.setPositions(gd, plotinfo);

0 commit comments

Comments
 (0)