Skip to content

Commit 6cc0165

Browse files
authored
Merge pull request #5964 from plotly/invisible-axis-prefix-hover
Display prefix and suffix of invisible polar axes in hover
2 parents 6f93045 + 2f983e3 commit 6cc0165

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

draftlogs/5964_fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Display prefix and suffix of invisible polar axes in hover [[#5964](https://github.com/plotly/plotly.js/pull/5964)]

src/plots/polar/layout_defaults.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,12 @@ function handleDefaults(contIn, contOut, coerce, opts) {
137137
break;
138138
}
139139

140+
handlePrefixSuffixDefaults(axIn, axOut, coerceAxis, axOut.type, {
141+
tickSuffixDflt: axOut.thetaunit === 'degrees' ? '°' : undefined
142+
});
143+
140144
if(visible) {
141145
handleTickValueDefaults(axIn, axOut, coerceAxis, axOut.type);
142-
handlePrefixSuffixDefaults(axIn, axOut, coerceAxis, axOut.type, {
143-
tickSuffixDflt: axOut.thetaunit === 'degrees' ? '°' : undefined
144-
});
145146
handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type);
146147
handleTickMarkDefaults(axIn, axOut, coerceAxis, {outerTicks: true});
147148

test/jasmine/tests/scatterpolar_test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,30 @@ describe('Test scatterpolar hover:', function() {
192192
},
193193
nums: 'r: 4.022892\nθ: 128.342°\n4.02289202968',
194194
name: 'Trial 3'
195+
}, {
196+
desc: 'with prefix and suffix',
197+
patch: function(fig) {
198+
fig.layout.polar.radialaxis.tickprefix = '(';
199+
fig.layout.polar.radialaxis.ticksuffix = ')';
200+
fig.layout.polar.angularaxis.tickprefix = '[';
201+
fig.layout.polar.angularaxis.ticksuffix = ']';
202+
return fig;
203+
},
204+
nums: 'r: (4.022892)\nθ: [128.342]',
205+
name: 'Trial 3'
206+
}, {
207+
desc: 'with prefix and suffix on invisible axes',
208+
patch: function(fig) {
209+
fig.layout.polar.radialaxis.visible = false,
210+
fig.layout.polar.radialaxis.tickprefix = '(';
211+
fig.layout.polar.radialaxis.ticksuffix = ')';
212+
fig.layout.polar.angularaxis.visible = false;
213+
fig.layout.polar.angularaxis.tickprefix = '[';
214+
fig.layout.polar.angularaxis.ticksuffix = ']';
215+
return fig;
216+
},
217+
nums: 'r: (4.022892)\nθ: [128.342]',
218+
name: 'Trial 3'
195219
}]
196220
.forEach(function(specs) {
197221
it('should generate correct hover labels ' + specs.desc, function(done) {

0 commit comments

Comments
 (0)