Skip to content

Commit

Permalink
Merge pull request #5485 from plotly/lat-lon-hover
Browse files Browse the repository at this point in the history
Switch to latLon hoverlabel
  • Loading branch information
archmoj authored Feb 10, 2021
2 parents 779afe6 + 122fd25 commit 6f031b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit 6f031b2

Please sign in to comment.