Skip to content

Commit 1feeac7

Browse files
committed
don't coerce hoverformat category polar axes
.. to be consistent with cartesian axes.
1 parent 54a6e5c commit 1feeac7

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/plots/polar/layout_defaults.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ function handleDefaults(contIn, contOut, coerce, opts) {
143143
if(visible) {
144144
handleTickValueDefaults(axIn, axOut, coerceAxis, axOut.type);
145145
handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type, {
146-
noHover: false,
147146
tickSuffixDflt: axOut.thetaunit === 'degrees' ? '°' : undefined
148147
});
149148
handleTickMarkDefaults(axIn, axOut, coerceAxis, {outerTicks: true});
@@ -174,7 +173,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
174173
coerceAxis('layer');
175174
}
176175

177-
coerceAxis('hoverformat');
176+
if(axType !== 'category') coerceAxis('hoverformat');
178177

179178
axOut._input = axIn;
180179
}

test/jasmine/tests/polar_test.js

+37
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,43 @@ describe('Test polar plots defaults:', function() {
168168
expect(Lib.log).toHaveBeenCalledWith('Polar plots do not support date angular axes yet.');
169169
expect(layoutOut.polar.angularaxis.type).toBe('linear');
170170
});
171+
172+
it('should not coerce hoverformat on category axes', function() {
173+
_supply({}, [{
174+
type: 'scatterpolar',
175+
r: ['a', 'b'],
176+
theta: ['c', 'd'],
177+
visible: true,
178+
subplot: 'polar'
179+
}]);
180+
181+
expect(layoutOut.polar.radialaxis.hoverformat).toBeUndefined();
182+
expect(layoutOut.polar.angularaxis.hoverformat).toBeUndefined();
183+
});
184+
185+
it('should coerce hoverformat even for `visible: false` axes', function() {
186+
_supply({
187+
polar: {
188+
radialaxis: {
189+
visible: false,
190+
hoverformat: 'g'
191+
},
192+
angularaxis: {
193+
visible: false,
194+
hoverformat: 'g'
195+
}
196+
}
197+
}, [{
198+
type: 'scatterpolar',
199+
r: [1, 2],
200+
theta: [90, 180],
201+
visible: true,
202+
subplot: 'polar'
203+
}]);
204+
205+
expect(layoutOut.polar.radialaxis.hoverformat).toBe('g');
206+
expect(layoutOut.polar.angularaxis.hoverformat).toBe('g');
207+
});
171208
});
172209

173210
describe('Test relayout on polar subplots:', function() {

0 commit comments

Comments
 (0)