Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to latLon hoverlabel #5485

Merged
merged 1 commit into from
Feb 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/traces/scattergeo/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function getExtraText(trace, pt, pointData, labels) {
if(hasLocation) {
text.push(pt.loc);
} else if(hasLon && hasLat) {
text.push('(' + format(pointData.lonLabel) + ', ' + format(pointData.latLabel) + ')');
text.push('(' + format(pointData.latLabel) + ', ' + format(pointData.lonLabel) + ')');
} else if(hasLon) {
text.push(labels.lon + format(pointData.lonLabel));
} else if(hasLat) {
Expand Down
6 changes: 3 additions & 3 deletions test/jasmine/tests/scattergeo_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ describe('Test scattergeo hover', function() {

describe('should preserve lon/lat formatting hovetemplate equivalence', function() {
var pos = [381, 221];
var exp = ['(10.00012°, 10.00088°)\nA'];
var exp = ['(10.00088°, 10.00012°)\nA'];

it('- base case (truncate z decimals)', function(done) {
Plotly.restyle(gd, {
Expand All @@ -427,11 +427,11 @@ describe('Test scattergeo hover', function() {
.then(done, done.fail);
});

it('- hovertemplate case (same lon/lat truncation)', function(done) {
it('- hovertemplate case (same lat/lon truncation)', function(done) {
Plotly.restyle(gd, {
lon: [[10.0001221321]],
lat: [[10.00087683]],
hovertemplate: '(%{lon}°, %{lat}°)<br>%{text}<extra></extra>'
hovertemplate: '(%{lat}°, %{lon}°)<br>%{text}<extra></extra>'
})
.then(function() { check(pos, exp); })
.then(done, done.fail);
Expand Down