Skip to content

Commit 80717d5

Browse files
committed
require doTicksSingle and setConvertCartesian directly
1 parent e9c3ef8 commit 80717d5

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

src/plots/polar/polar.js

+19-21
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ var Lib = require('../../lib');
1616
var Color = require('../../components/color');
1717
var Drawing = require('../../components/drawing');
1818
var Plots = require('../plots');
19-
var Axes = require('../cartesian/axes');
19+
var setConvertCartesian = require('../cartesian/set_convert');
2020
var doAutoRange = require('../cartesian/autorange').doAutoRange;
21-
var dragElement = require('../../components/dragelement');
21+
var doTicksSingle = require('../cartesian/axes').doTicksSingle;
2222
var dragBox = require('../cartesian/dragbox');
23+
var dragElement = require('../../components/dragelement');
2324
var Fx = require('../../components/fx');
2425
var Titles = require('../../components/titles');
2526
var prepSelect = require('../cartesian/select').prepSelect;
@@ -63,7 +64,7 @@ function Polar(gd, id) {
6364
.attr('class', id);
6465

6566
// unfortunately, we have to keep track of some axis tick settings
66-
// so that we don't have to call Axes.doTicksSingle with its special redraw flag
67+
// so that we don't have to call doTicksSingle with its special redraw flag
6768
this.radialTickLayout = null;
6869
this.angularTickLayout = null;
6970
}
@@ -264,7 +265,7 @@ proto.updateLayout = function(fullLayout, polarLayout) {
264265
range: [sectorBBox[0] * rSpan, sectorBBox[2] * rSpan],
265266
domain: xDomain2
266267
};
267-
Axes.setConvert(xaxis, fullLayout);
268+
setConvertCartesian(xaxis, fullLayout);
268269
xaxis.setScale();
269270

270271
var yaxis = _this.yaxis = {
@@ -273,7 +274,7 @@ proto.updateLayout = function(fullLayout, polarLayout) {
273274
range: [sectorBBox[1] * rSpan, sectorBBox[3] * rSpan],
274275
domain: yDomain2
275276
};
276-
Axes.setConvert(yaxis, fullLayout);
277+
setConvertCartesian(yaxis, fullLayout);
277278
yaxis.setScale();
278279

279280
xaxis.isPtWithinRange = function(d) { return _this.isPtWithinSector(d); };
@@ -298,14 +299,16 @@ proto.updateLayout = function(fullLayout, polarLayout) {
298299
};
299300

300301
proto.doAutoRange = function(fullLayout, polarLayout) {
302+
var gd = this.gd;
303+
var radialAxis = this.radialAxis;
301304
var radialLayout = polarLayout.radialaxis;
302-
var ax = this.radialAxis;
303305

304-
setScale(ax, radialLayout, fullLayout);
305-
doAutoRange(this.gd, ax);
306+
radialAxis.setScale();
307+
doAutoRange(gd, radialAxis);
306308

307-
radialLayout.range = ax.range.slice();
308-
radialLayout._input.range = ax.range.slice();
309+
var rng = radialAxis.range;
310+
radialLayout.range = rng.slice();
311+
radialLayout._input.range = rng.slice();
309312
};
310313

311314
proto.updateRadialAxis = function(fullLayout, polarLayout) {
@@ -348,7 +351,8 @@ proto.updateRadialAxis = function(fullLayout, polarLayout) {
348351
_this.radialTickLayout = newTickLayout;
349352
}
350353

351-
Axes.doTicksSingle(gd, ax, true);
354+
ax.setScale();
355+
doTicksSingle(gd, ax, true);
352356

353357
// stash 'actual' radial axis angle for drag handlers (in degrees)
354358
var angle = _this.radialAxisAngle = _this.vangles ?
@@ -468,8 +472,6 @@ proto.updateAngularAxis = function(fullLayout, polarLayout) {
468472
ax._tickFilter = function(d) { return isAngleInSector(c2rad(d), sector); };
469473
}
470474

471-
setScale(ax, angularLayout, fullLayout);
472-
473475
ax._transfn = function(d) {
474476
var rad = c2rad(d);
475477
var xy = rad2xy(rad);
@@ -530,7 +532,8 @@ proto.updateAngularAxis = function(fullLayout, polarLayout) {
530532
_this.angularTickLayout = newTickLayout;
531533
}
532534

533-
Axes.doTicksSingle(gd, ax, true);
535+
ax.setScale();
536+
doTicksSingle(gd, ax, true);
534537

535538
// angle of polygon vertices in radians (null means circles)
536539
// TODO what to do when ax.period > ax._categories ??
@@ -956,7 +959,7 @@ proto.updateRadialDrag = function(fullLayout, polarLayout) {
956959
if((drange > 0) !== (rprime > range0[0])) return;
957960
rng1 = radialAxis.range[1] = rprime;
958961

959-
Axes.doTicksSingle(gd, _this.radialAxis, true);
962+
doTicksSingle(gd, _this.radialAxis, true);
960963
layers['radial-grid']
961964
.attr('transform', strTranslate(cx, cy))
962965
.selectAll('path').attr('transform', null);
@@ -1112,7 +1115,7 @@ proto.updateAngularDrag = function(fullLayout, polarLayout) {
11121115
}
11131116

11141117
setConvertAngular(angularAxis);
1115-
Axes.doTicksSingle(gd, angularAxis, true);
1118+
doTicksSingle(gd, angularAxis, true);
11161119

11171120
if(_this._hasClipOnAxisFalse && !isFullCircle(sector)) {
11181121
// mutate sector to trick isPtWithinSector
@@ -1205,11 +1208,6 @@ proto.fillViewInitialKey = function(key, val) {
12051208
}
12061209
};
12071210

1208-
function setScale(ax, axLayout, fullLayout) {
1209-
Axes.setConvert(ax, fullLayout);
1210-
ax.setScale();
1211-
}
1212-
12131211
function strTickLayout(axLayout) {
12141212
var out = axLayout.ticks + String(axLayout.ticklen) + String(axLayout.showticklabels);
12151213
if('side' in axLayout) out += axLayout.side;

0 commit comments

Comments
 (0)