Skip to content

Commit 0c517d1

Browse files
committed
use isAngular helper in axes.js
1 parent f5bceda commit 0c517d1

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/plots/cartesian/axes.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ axes.calcTicks = function calcTicks(ax) {
554554

555555
// If same angle over a full circle, the last tick vals is a duplicate.
556556
// 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) {
558558
vals.pop();
559559
}
560560

@@ -722,7 +722,7 @@ axes.autoTicks = function(ax, roughDTick) {
722722
ax.tick0 = 0;
723723
ax.dtick = Math.ceil(Math.max(roughDTick, 1));
724724
}
725-
else if(ax._id === 'angularaxis') {
725+
else if(isAngular(ax)) {
726726
ax.tick0 = 0;
727727
base = 1;
728728
ax.dtick = roundDTick(roughDTick, base, roundAngles);
@@ -958,7 +958,7 @@ axes.tickText = function(ax, x, hover) {
958958
if(ax.type === 'date') formatDate(ax, out, hover, extraPrecision);
959959
else if(ax.type === 'log') formatLog(ax, out, hover, extraPrecision, hideexp);
960960
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);
962962
else formatLinear(ax, out, hover, extraPrecision, hideexp);
963963

964964
// add prefix and suffix
@@ -1646,7 +1646,7 @@ axes.doTicksSingle = function(gd, arg, skipTitle) {
16461646
else return 'M' + shift + ',0h' + len;
16471647
};
16481648
}
1649-
else if(axid === 'angularaxis') {
1649+
else if(isAngular(ax)) {
16501650
sides = ['left', 'right'];
16511651
transfn = ax._transfn;
16521652
tickpathfn = function(shift, len) {
@@ -1682,7 +1682,7 @@ axes.doTicksSingle = function(gd, arg, skipTitle) {
16821682
var valsClipped = vals.filter(clipEnds);
16831683

16841684
// don't clip angular values
1685-
if(ax._id === 'angularaxis') {
1685+
if(isAngular(ax)) {
16861686
valsClipped = vals;
16871687
}
16881688

@@ -1751,7 +1751,7 @@ axes.doTicksSingle = function(gd, arg, skipTitle) {
17511751
return axside === 'right' ? 'start' : 'end';
17521752
};
17531753
}
1754-
else if(axid === 'angularaxis') {
1754+
else if(isAngular(ax)) {
17551755
ax._labelShift = labelShift;
17561756
ax._labelStandoff = labelStandoff;
17571757
ax._pad = pad;
@@ -1798,7 +1798,7 @@ axes.doTicksSingle = function(gd, arg, skipTitle) {
17981798
maxFontSize = Math.max(maxFontSize, d.fontSize);
17991799
});
18001800

1801-
if(axid === 'angularaxis') {
1801+
if(isAngular(ax)) {
18021802
tickLabels.each(function(d) {
18031803
d3.select(this).select('text')
18041804
.call(svgTextUtils.positionText, labelx(d), labely(d));
@@ -2425,3 +2425,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes, dfltTitle) {
24252425
np(layout, yFullAxes[i]._name + '.' + key).set(xVal);
24262426
}
24272427
}
2428+
2429+
function isAngular(ax) {
2430+
return ax._id === 'angularaxis';
2431+
}

0 commit comments

Comments
 (0)