@@ -554,7 +554,7 @@ axes.calcTicks = function calcTicks(ax) {
554
554
555
555
// If same angle over a full circle, the last tick vals is a duplicate.
556
556
// TODO must do something similar for angular date axes.
557
- if ( ax . _id === 'angularaxis' && Math . abs ( rng [ 1 ] - rng [ 0 ] ) === 360 ) {
557
+ if ( isAngular ( ax ) && Math . abs ( rng [ 1 ] - rng [ 0 ] ) === 360 ) {
558
558
vals . pop ( ) ;
559
559
}
560
560
@@ -722,7 +722,7 @@ axes.autoTicks = function(ax, roughDTick) {
722
722
ax . tick0 = 0 ;
723
723
ax . dtick = Math . ceil ( Math . max ( roughDTick , 1 ) ) ;
724
724
}
725
- else if ( ax . _id === 'angularaxis' ) {
725
+ else if ( isAngular ( ax ) ) {
726
726
ax . tick0 = 0 ;
727
727
base = 1 ;
728
728
ax . dtick = roundDTick ( roughDTick , base , roundAngles ) ;
@@ -958,7 +958,7 @@ axes.tickText = function(ax, x, hover) {
958
958
if ( ax . type === 'date' ) formatDate ( ax , out , hover , extraPrecision ) ;
959
959
else if ( ax . type === 'log' ) formatLog ( ax , out , hover , extraPrecision , hideexp ) ;
960
960
else if ( ax . type === 'category' ) formatCategory ( ax , out ) ;
961
- else if ( ax . _id === 'angularaxis' ) formatAngle ( ax , out , hover , extraPrecision , hideexp ) ;
961
+ else if ( isAngular ( ax ) ) formatAngle ( ax , out , hover , extraPrecision , hideexp ) ;
962
962
else formatLinear ( ax , out , hover , extraPrecision , hideexp ) ;
963
963
964
964
// add prefix and suffix
@@ -1646,7 +1646,7 @@ axes.doTicksSingle = function(gd, arg, skipTitle) {
1646
1646
else return 'M' + shift + ',0h' + len ;
1647
1647
} ;
1648
1648
}
1649
- else if ( axid === 'angularaxis' ) {
1649
+ else if ( isAngular ( ax ) ) {
1650
1650
sides = [ 'left' , 'right' ] ;
1651
1651
transfn = ax . _transfn ;
1652
1652
tickpathfn = function ( shift , len ) {
@@ -1682,7 +1682,7 @@ axes.doTicksSingle = function(gd, arg, skipTitle) {
1682
1682
var valsClipped = vals . filter ( clipEnds ) ;
1683
1683
1684
1684
// don't clip angular values
1685
- if ( ax . _id === 'angularaxis' ) {
1685
+ if ( isAngular ( ax ) ) {
1686
1686
valsClipped = vals ;
1687
1687
}
1688
1688
@@ -1751,7 +1751,7 @@ axes.doTicksSingle = function(gd, arg, skipTitle) {
1751
1751
return axside === 'right' ? 'start' : 'end' ;
1752
1752
} ;
1753
1753
}
1754
- else if ( axid === 'angularaxis' ) {
1754
+ else if ( isAngular ( ax ) ) {
1755
1755
ax . _labelShift = labelShift ;
1756
1756
ax . _labelStandoff = labelStandoff ;
1757
1757
ax . _pad = pad ;
@@ -1798,7 +1798,7 @@ axes.doTicksSingle = function(gd, arg, skipTitle) {
1798
1798
maxFontSize = Math . max ( maxFontSize , d . fontSize ) ;
1799
1799
} ) ;
1800
1800
1801
- if ( axid === 'angularaxis' ) {
1801
+ if ( isAngular ( ax ) ) {
1802
1802
tickLabels . each ( function ( d ) {
1803
1803
d3 . select ( this ) . select ( 'text' )
1804
1804
. call ( svgTextUtils . positionText , labelx ( d ) , labely ( d ) ) ;
@@ -2425,3 +2425,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes, dfltTitle) {
2425
2425
np ( layout , yFullAxes [ i ] . _name + '.' + key ) . set ( xVal ) ;
2426
2426
}
2427
2427
}
2428
+
2429
+ function isAngular ( ax ) {
2430
+ return ax . _id === 'angularaxis' ;
2431
+ }
0 commit comments