@@ -16,10 +16,11 @@ var Lib = require('../../lib');
16
16
var Color = require ( '../../components/color' ) ;
17
17
var Drawing = require ( '../../components/drawing' ) ;
18
18
var Plots = require ( '../plots' ) ;
19
- var Axes = require ( '../cartesian/axes ' ) ;
19
+ var setConvertCartesian = require ( '../cartesian/set_convert ' ) ;
20
20
var doAutoRange = require ( '../cartesian/autorange' ) . doAutoRange ;
21
- var dragElement = require ( '../../components/dragelement' ) ;
21
+ var doTicksSingle = require ( '../cartesian/axes' ) . doTicksSingle ;
22
22
var dragBox = require ( '../cartesian/dragbox' ) ;
23
+ var dragElement = require ( '../../components/dragelement' ) ;
23
24
var Fx = require ( '../../components/fx' ) ;
24
25
var Titles = require ( '../../components/titles' ) ;
25
26
var prepSelect = require ( '../cartesian/select' ) . prepSelect ;
@@ -63,7 +64,7 @@ function Polar(gd, id) {
63
64
. attr ( 'class' , id ) ;
64
65
65
66
// 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
67
68
this . radialTickLayout = null ;
68
69
this . angularTickLayout = null ;
69
70
}
@@ -264,7 +265,7 @@ proto.updateLayout = function(fullLayout, polarLayout) {
264
265
range : [ sectorBBox [ 0 ] * rSpan , sectorBBox [ 2 ] * rSpan ] ,
265
266
domain : xDomain2
266
267
} ;
267
- Axes . setConvert ( xaxis , fullLayout ) ;
268
+ setConvertCartesian ( xaxis , fullLayout ) ;
268
269
xaxis . setScale ( ) ;
269
270
270
271
var yaxis = _this . yaxis = {
@@ -273,7 +274,7 @@ proto.updateLayout = function(fullLayout, polarLayout) {
273
274
range : [ sectorBBox [ 1 ] * rSpan , sectorBBox [ 3 ] * rSpan ] ,
274
275
domain : yDomain2
275
276
} ;
276
- Axes . setConvert ( yaxis , fullLayout ) ;
277
+ setConvertCartesian ( yaxis , fullLayout ) ;
277
278
yaxis . setScale ( ) ;
278
279
279
280
xaxis . isPtWithinRange = function ( d ) { return _this . isPtWithinSector ( d ) ; } ;
@@ -298,14 +299,16 @@ proto.updateLayout = function(fullLayout, polarLayout) {
298
299
} ;
299
300
300
301
proto . doAutoRange = function ( fullLayout , polarLayout ) {
302
+ var gd = this . gd ;
303
+ var radialAxis = this . radialAxis ;
301
304
var radialLayout = polarLayout . radialaxis ;
302
- var ax = this . radialAxis ;
303
305
304
- setScale ( ax , radialLayout , fullLayout ) ;
305
- doAutoRange ( this . gd , ax ) ;
306
+ radialAxis . setScale ( ) ;
307
+ doAutoRange ( gd , radialAxis ) ;
306
308
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 ( ) ;
309
312
} ;
310
313
311
314
proto . updateRadialAxis = function ( fullLayout , polarLayout ) {
@@ -348,7 +351,8 @@ proto.updateRadialAxis = function(fullLayout, polarLayout) {
348
351
_this . radialTickLayout = newTickLayout ;
349
352
}
350
353
351
- Axes . doTicksSingle ( gd , ax , true ) ;
354
+ ax . setScale ( ) ;
355
+ doTicksSingle ( gd , ax , true ) ;
352
356
353
357
// stash 'actual' radial axis angle for drag handlers (in degrees)
354
358
var angle = _this . radialAxisAngle = _this . vangles ?
@@ -468,8 +472,6 @@ proto.updateAngularAxis = function(fullLayout, polarLayout) {
468
472
ax . _tickFilter = function ( d ) { return isAngleInSector ( c2rad ( d ) , sector ) ; } ;
469
473
}
470
474
471
- setScale ( ax , angularLayout , fullLayout ) ;
472
-
473
475
ax . _transfn = function ( d ) {
474
476
var rad = c2rad ( d ) ;
475
477
var xy = rad2xy ( rad ) ;
@@ -530,7 +532,8 @@ proto.updateAngularAxis = function(fullLayout, polarLayout) {
530
532
_this . angularTickLayout = newTickLayout ;
531
533
}
532
534
533
- Axes . doTicksSingle ( gd , ax , true ) ;
535
+ ax . setScale ( ) ;
536
+ doTicksSingle ( gd , ax , true ) ;
534
537
535
538
// angle of polygon vertices in radians (null means circles)
536
539
// TODO what to do when ax.period > ax._categories ??
@@ -956,7 +959,7 @@ proto.updateRadialDrag = function(fullLayout, polarLayout) {
956
959
if ( ( drange > 0 ) !== ( rprime > range0 [ 0 ] ) ) return ;
957
960
rng1 = radialAxis . range [ 1 ] = rprime ;
958
961
959
- Axes . doTicksSingle ( gd , _this . radialAxis , true ) ;
962
+ doTicksSingle ( gd , _this . radialAxis , true ) ;
960
963
layers [ 'radial-grid' ]
961
964
. attr ( 'transform' , strTranslate ( cx , cy ) )
962
965
. selectAll ( 'path' ) . attr ( 'transform' , null ) ;
@@ -1112,7 +1115,7 @@ proto.updateAngularDrag = function(fullLayout, polarLayout) {
1112
1115
}
1113
1116
1114
1117
setConvertAngular ( angularAxis ) ;
1115
- Axes . doTicksSingle ( gd , angularAxis , true ) ;
1118
+ doTicksSingle ( gd , angularAxis , true ) ;
1116
1119
1117
1120
if ( _this . _hasClipOnAxisFalse && ! isFullCircle ( sector ) ) {
1118
1121
// mutate sector to trick isPtWithinSector
@@ -1205,11 +1208,6 @@ proto.fillViewInitialKey = function(key, val) {
1205
1208
}
1206
1209
} ;
1207
1210
1208
- function setScale ( ax , axLayout , fullLayout ) {
1209
- Axes . setConvert ( ax , fullLayout ) ;
1210
- ax . setScale ( ) ;
1211
- }
1212
-
1213
1211
function strTickLayout ( axLayout ) {
1214
1212
var out = axLayout . ticks + String ( axLayout . ticklen ) + String ( axLayout . showticklabels ) ;
1215
1213
if ( 'side' in axLayout ) out += axLayout . side ;
0 commit comments