@@ -143,37 +143,40 @@ function setConvertAngular(ax, polarLayout) {
143143 var dir = { clockwise : - 1 , counterclockwise : 1 } [ ax . direction ] ;
144144 var rot = deg2rad ( ax . rotation ) ;
145145
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 ;
148151
149152 switch ( axType ) {
150153 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 ;
154157
155158 // Set the angular range in degrees to make auto-tick computation cleaner,
156159 // changing rotation/direction should not affect the angular tick value.
157160 ax . range = isFullCircle ( sector ) ?
158161 sector . slice ( ) :
159- sector . map ( deg2rad ) . map ( ax . g2rad ) . map ( rad2deg ) ;
162+ sector . map ( deg2rad ) . map ( g2rad ) . map ( rad2deg ) ;
160163 break ;
161164
162165 case 'category' :
163166 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 ;
165168
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 ; } ;
168171
169172 ax . range = [ 0 , _period ] ;
170173 break ;
171174 }
172175
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 ) ) ; } ;
175178
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 ) ) ; } ;
178181 } ;
179182}
0 commit comments