Skip to content

Commit 7d21680

Browse files
committed
texttemplate: fix scattergeo variable names
1 parent 0b516f7 commit 7d21680

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

src/traces/scattergeo/attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ module.exports = overrideAll({
6666
].join(' ')
6767
}),
6868
texttemplate: texttemplateAttrs({editType: 'plot'}, {
69-
keys: ['latlon', 'text']
69+
keys: ['lat', 'lon', 'location', 'text']
7070
}),
7171
hovertext: extendFlat({}, scatterAttrs.hovertext, {
7272
description: [
616 Bytes
Loading

test/image/mocks/texttemplate_scatter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"Toronto",
1818
"Vancouver"
1919
],
20-
"texttemplate": "%{text}: (%{lonlat[0]:.0f}, %{lonlat[1]:0.f}): %{customdata:.2s}",
20+
"texttemplate": "%{text}: (%{lon:.0f}, %{lat:0.f}): %{customdata:.2s}",
2121
"textposition": "top center",
2222
"customdata": [1780000, 2930000, 675218],
2323
"geo": "geo"

test/jasmine/tests/scattergeo_test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,15 @@ describe('Test scattergeo texttemplate:', function() {
446446
'lat': [45.5, 43.4, 49.13],
447447
'text': ['Montreal', 'Toronto', 'Vancouver']
448448
}], '.scattergeo text', [
449-
['%{text}: %{lonlat[0]}, %{lonlat[1]}', ['Montreal: -73.57, 45.5', 'Toronto: -79.24, 43.4', 'Vancouver: -123.06, 49.13']]
449+
['%{text}: %{lon}, %{lat}', ['Montreal: -73.57, 45.5', 'Toronto: -79.24, 43.4', 'Vancouver: -123.06, 49.13']]
450+
]);
451+
452+
checkTextTemplate([{
453+
'type': 'scattergeo',
454+
'mode': 'markers+text',
455+
'locations': ['Canada'],
456+
'locationmode': 'country names'
457+
}], '.scattergeo text', [
458+
['%{location}', ['Canada']]
450459
]);
451460
});

0 commit comments

Comments
 (0)