Skip to content

Commit 3787bfa

Browse files
committed
sub angularAxis._id 'angular' -> 'angularaxis'
... which is on-par with fullLayout.polar.angularaxis
1 parent 91064ca commit 3787bfa

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

src/plots/cartesian/axes.js

+7-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 === 'angular' && Math.abs(rng[1] - rng[0]) === 360) {
557+
if(ax._id === 'angularaxis' && 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 === 'angular') {
725+
else if(ax._id === 'angularaxis') {
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 === 'angular') formatAngle(ax, out, hover, extraPrecision, hideexp);
961+
else if(ax._id === 'angularaxis') 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 === 'angular') {
1649+
else if(axid === 'angularaxis') {
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 === 'angular') {
1685+
if(ax._id === 'angularaxis') {
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 === 'angular') {
1754+
else if(axid === 'angularaxis') {
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 === 'angular') {
1801+
if(axid === 'angularaxis') {
18021802
tickLabels.each(function(d) {
18031803
d3.select(this).select('text')
18041804
.call(svgTextUtils.positionText, labelx(d), labely(d));

src/plots/polar/polar.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ proto.updateLayers = function(fullLayout, polarLayout) {
142142
break;
143143
case 'angular-grid':
144144
sel.style('fill', 'none');
145-
sel.append('g').classed('angular', 1);
145+
sel.append('g').classed('angularaxis', 1);
146146
break;
147147
case 'radial-line':
148148
sel.append('line').style('fill', 'none');
@@ -257,8 +257,6 @@ proto.updateLayout = function(fullLayout, polarLayout) {
257257
_this.angularAxis = _this.mockAxis(fullLayout, polarLayout, angularLayout, {
258258
_axislayer: layers['angular-axis'],
259259
_gridlayer: layers['angular-grid'],
260-
// angular axes need *special* logic
261-
_id: 'angular',
262260
side: 'right',
263261
// to get auto nticks right
264262
domain: [0, Math.PI],
@@ -547,7 +545,7 @@ proto.updateAngularAxis = function(fullLayout, polarLayout) {
547545

548546
var newTickLayout = strTickLayout(angularLayout);
549547
if(_this.angularTickLayout !== newTickLayout) {
550-
layers['angular-axis'].selectAll('.angulartick').remove();
548+
layers['angular-axis'].selectAll('.' + ax._id + 'tick').remove();
551549
_this.angularTickLayout = newTickLayout;
552550
}
553551

src/plots/polar/set_convert.js

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ module.exports = function setConvert(ax, polarLayout, fullLayout) {
5757
case 'radialaxis':
5858
setConvertRadial(ax);
5959
break;
60-
case 'angular':
6160
case 'angularaxis':
6261
setConvertAngular(ax, polarLayout);
6362
break;

test/jasmine/tests/polar_test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,14 @@ describe('Test relayout on polar subplots:', function() {
306306
var pos1 = [];
307307

308308
Plotly.plot(gd, fig).then(function() {
309-
d3.selectAll('.angulartick> text').each(function() {
309+
d3.selectAll('.angularaxistick > text').each(function() {
310310
var tx = d3.select(this);
311311
pos0.push([tx.attr('x'), tx.attr('y')]);
312312
});
313313
return Plotly.relayout(gd, 'polar.angularaxis.rotation', 90);
314314
})
315315
.then(function() {
316-
d3.selectAll('.angulartick> text').each(function() {
316+
d3.selectAll('.angularaxistick > text').each(function() {
317317
var tx = d3.select(this);
318318
pos1.push([tx.attr('x'), tx.attr('y')]);
319319
});
@@ -330,7 +330,7 @@ describe('Test relayout on polar subplots:', function() {
330330
var fig = Lib.extendDeep({}, require('@mocks/polar_scatter.json'));
331331

332332
function check(cnt, expected) {
333-
var ticks = d3.selectAll('path.angulartick');
333+
var ticks = d3.selectAll('path.angularaxistick');
334334

335335
expect(ticks.size()).toBe(cnt, '# of ticks');
336336
ticks.each(function() {
@@ -433,21 +433,21 @@ describe('Test relayout on polar subplots:', function() {
433433
return toggle(
434434
'polar.angularaxis.showgrid',
435435
[true, false], [8, 0],
436-
'.angular-grid > .angular > path', assertCnt
436+
'.angular-grid > .angularaxis > path', assertCnt
437437
);
438438
})
439439
.then(function() {
440440
return toggle(
441441
'polar.angularaxis.showticklabels',
442442
[true, false], [8, 0],
443-
'.angular-axis > .angulartick > text', assertCnt
443+
'.angular-axis > .angularaxistick > text', assertCnt
444444
);
445445
})
446446
.then(function() {
447447
return toggle(
448448
'polar.angularaxis.ticks',
449449
['outside', ''], [8, 0],
450-
'.angular-axis > path.angulartick', assertCnt
450+
'.angular-axis > path.angularaxistick', assertCnt
451451
);
452452
})
453453
.catch(failTest)
@@ -558,7 +558,7 @@ describe('Test relayout on polar subplots:', function() {
558558
expect(gd._fullLayout.polar._subplot.angularAxis.range)
559559
.toBeCloseToArray([0, exp.period], 2, 'range in mocked angular axis - ' + msg);
560560

561-
expect(d3.selectAll('path.angulartick').size())
561+
expect(d3.selectAll('path.angularaxistick').size())
562562
.toBe(exp.nTicks, '# of visible angular ticks - ' + msg);
563563

564564
expect([gd.calcdata[0][5].x, gd.calcdata[0][5].y])

0 commit comments

Comments
 (0)