@@ -143,37 +143,40 @@ function setConvertAngular(ax, polarLayout) {
143
143
var dir = { clockwise : - 1 , counterclockwise : 1 } [ ax . direction ] ;
144
144
var rot = deg2rad ( ax . rotation ) ;
145
145
146
- ax . rad2g = function ( v ) { return dir * v + rot ; } ;
147
- ax . g2rad = function ( v ) { return ( v - rot ) / dir ; } ;
146
+ var rad2g = function ( v ) { return dir * v + rot ; } ;
147
+ var g2rad = function ( v ) { return ( v - rot ) / dir ; } ;
148
+
149
+ var rad2c , c2rad ;
150
+ var rad2t , t2rad ;
148
151
149
152
switch ( axType ) {
150
153
case 'linear' :
151
- ax . c2rad = ax . rad2c = Lib . identity ;
152
- ax . t2rad = deg2rad ;
153
- ax . rad2r = rad2deg ;
154
+ c2rad = rad2c = Lib . identity ;
155
+ t2rad = deg2rad ;
156
+ rad2t = rad2deg ;
154
157
155
158
// Set the angular range in degrees to make auto-tick computation cleaner,
156
159
// changing rotation/direction should not affect the angular tick value.
157
160
ax . range = isFullCircle ( sector ) ?
158
161
sector . slice ( ) :
159
- sector . map ( deg2rad ) . map ( ax . g2rad ) . map ( rad2deg ) ;
162
+ sector . map ( deg2rad ) . map ( g2rad ) . map ( rad2deg ) ;
160
163
break ;
161
164
162
165
case 'category' :
163
166
var catLen = ax . _categories . length ;
164
- var _period = ax . _period = ax . period ? Math . max ( ax . period , catLen ) : catLen ;
167
+ var _period = ax . period ? Math . max ( ax . period , catLen ) : catLen ;
165
168
166
- ax . c2rad = ax . t2rad = function ( v ) { return v * 2 * Math . PI / _period ; } ;
167
- ax . rad2c = ax . rad2t = function ( v ) { return v * _period / Math . PI / 2 ; } ;
169
+ c2rad = t2rad = function ( v ) { return v * 2 * Math . PI / _period ; } ;
170
+ rad2c = rad2t = function ( v ) { return v * _period / Math . PI / 2 ; } ;
168
171
169
172
ax . range = [ 0 , _period ] ;
170
173
break ;
171
174
}
172
175
173
- ax . c2g = function ( v ) { return ax . rad2g ( ax . c2rad ( v ) ) ; } ;
174
- ax . g2c = function ( v ) { return ax . rad2c ( ax . g2rad ( v ) ) ; } ;
176
+ ax . c2g = function ( v ) { return rad2g ( c2rad ( v ) ) ; } ;
177
+ ax . g2c = function ( v ) { return rad2c ( g2rad ( v ) ) ; } ;
175
178
176
- ax . t2g = function ( v ) { return ax . rad2g ( ax . t2rad ( v ) ) ; } ;
177
- ax . g2t = function ( v ) { return ax . rad2t ( ax . g2rad ( v ) ) ; } ;
179
+ ax . t2g = function ( v ) { return rad2g ( t2rad ( v ) ) ; } ;
180
+ ax . g2t = function ( v ) { return rad2t ( g2rad ( v ) ) ; } ;
178
181
} ;
179
182
}
0 commit comments