From d73f2920317e5b907d65bf26de5de9dee2048c12 Mon Sep 17 00:00:00 2001 From: archmoj Date: Fri, 1 Oct 2021 12:16:34 -0400 Subject: [PATCH 1/3] coerce prefix and suffix for an invisible polar axis --- src/plots/polar/layout_defaults.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plots/polar/layout_defaults.js b/src/plots/polar/layout_defaults.js index 9a7c609ed2b..cbcf08cc9d4 100644 --- a/src/plots/polar/layout_defaults.js +++ b/src/plots/polar/layout_defaults.js @@ -137,11 +137,12 @@ function handleDefaults(contIn, contOut, coerce, opts) { break; } + handlePrefixSuffixDefaults(axIn, axOut, coerceAxis, axOut.type, { + tickSuffixDflt: axOut.thetaunit === 'degrees' ? '°' : undefined + }); + if(visible) { handleTickValueDefaults(axIn, axOut, coerceAxis, axOut.type); - handlePrefixSuffixDefaults(axIn, axOut, coerceAxis, axOut.type, { - tickSuffixDflt: axOut.thetaunit === 'degrees' ? '°' : undefined - }); handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type); handleTickMarkDefaults(axIn, axOut, coerceAxis, {outerTicks: true}); From 68760e80c449110bbd7ca3eaa1fa21a4ba4db8a8 Mon Sep 17 00:00:00 2001 From: archmoj Date: Fri, 1 Oct 2021 12:28:30 -0400 Subject: [PATCH 2/3] add test to lock issue 5962 --- test/jasmine/tests/scatterpolar_test.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/jasmine/tests/scatterpolar_test.js b/test/jasmine/tests/scatterpolar_test.js index a54f1548510..cdf153b01ec 100644 --- a/test/jasmine/tests/scatterpolar_test.js +++ b/test/jasmine/tests/scatterpolar_test.js @@ -192,6 +192,30 @@ describe('Test scatterpolar hover:', function() { }, nums: 'r: 4.022892\nθ: 128.342°\n4.02289202968', name: 'Trial 3' + }, { + desc: 'with prefix and suffix', + patch: function(fig) { + fig.layout.polar.radialaxis.tickprefix = '('; + fig.layout.polar.radialaxis.ticksuffix = ')'; + fig.layout.polar.angularaxis.tickprefix = '['; + fig.layout.polar.angularaxis.ticksuffix = ']'; + return fig; + }, + nums: 'r: (4.022892)\nθ: [128.342]', + name: 'Trial 3' + }, { + desc: 'with prefix and suffix on invisible axes', + patch: function(fig) { + fig.layout.polar.radialaxis.visible = false, + fig.layout.polar.radialaxis.tickprefix = '('; + fig.layout.polar.radialaxis.ticksuffix = ')'; + fig.layout.polar.angularaxis.visible = false; + fig.layout.polar.angularaxis.tickprefix = '['; + fig.layout.polar.angularaxis.ticksuffix = ']'; + return fig; + }, + nums: 'r: (4.022892)\nθ: [128.342]', + name: 'Trial 3' }] .forEach(function(specs) { it('should generate correct hover labels ' + specs.desc, function(done) { From 2f983e306f54dd8e5dba8c26423bc20342284d48 Mon Sep 17 00:00:00 2001 From: archmoj Date: Fri, 1 Oct 2021 13:53:28 -0400 Subject: [PATCH 3/3] draft log for PR 5964 --- draftlogs/5964_fix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 draftlogs/5964_fix.md diff --git a/draftlogs/5964_fix.md b/draftlogs/5964_fix.md new file mode 100644 index 00000000000..4f7e0438f38 --- /dev/null +++ b/draftlogs/5964_fix.md @@ -0,0 +1 @@ + - Display prefix and suffix of invisible polar axes in hover [[#5964](https://github.com/plotly/plotly.js/pull/5964)]