Skip to content

Commit 3dda912

Browse files
committed
texttemplate for scattermapbox: fix editType, improve style and mock
1 parent 836d5a2 commit 3dda912

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/traces/scattermapbox/attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module.exports = overrideAll({
5050
'these elements will be seen in the hover labels.'
5151
].join(' ')
5252
}),
53-
texttemplate: texttemplateAttrs({editType: 'calc'}, {
53+
texttemplate: texttemplateAttrs({editType: 'plot'}, {
5454
keys: ['lat', 'lon', 'text']
5555
}),
5656
hovertext: extendFlat({}, scatterAttrs.hovertext, {

src/traces/scattermapbox/convert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var makeBubbleSizeFn = require('../scatter/make_bubble_size_func');
2020
var subTypes = require('../scatter/subtypes');
2121
var convertTextOpts = require('../../plots/mapbox/convert_text_opts');
2222

23-
module.exports = function convert(calcTrace, gd) {
23+
module.exports = function convert(gd, calcTrace) {
2424
var trace = calcTrace[0].trace;
2525

2626
var isVisible = (trace.visible === true && trace._length !== 0);

src/traces/scattermapbox/plot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ proto.addLayer = function(k, opts, below) {
6767
proto.update = function update(calcTrace) {
6868
var subplot = this.subplot;
6969
var map = subplot.map;
70-
var optsAll = convert(calcTrace, subplot.gd);
70+
var optsAll = convert(subplot.gd, calcTrace);
7171
var below = subplot.belowLookup['trace-' + this.uid];
7272
var i, k, opts;
7373

@@ -113,7 +113,7 @@ proto.dispose = function dispose() {
113113
module.exports = function createScatterMapbox(subplot, calcTrace) {
114114
var trace = calcTrace[0].trace;
115115
var scatterMapbox = new ScatterMapbox(subplot, trace.uid);
116-
var optsAll = convert(calcTrace, subplot.gd);
116+
var optsAll = convert(subplot.gd, calcTrace);
117117
var below = scatterMapbox.below = subplot.belowLookup['trace-' + trace.uid];
118118

119119
for(var i = 0; i < ORDER.length; i++) {

test/image/mocks/mapbox_texttemplate.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]}, %{lonlat[1]}): %{customdata:.2s}",
20+
"texttemplate": "%{text} (%{lon}, %{lat}): %{customdata:.2s}",
2121
"textposition": "top center",
2222
"customdata": [1780000, 2930000, 675218]
2323
}],

test/jasmine/tests/scattermapbox_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('scattermapbox convert', function() {
139139
Plots.doCalcdata(gd, fullTrace);
140140

141141
var calcTrace = gd.calcdata[0];
142-
return convert(calcTrace, {_fullLayout: {_d3locale: false}});
142+
return convert({_fullLayout: {_d3locale: false}}, calcTrace);
143143
}
144144

145145
function assertVisibility(opts, expectations) {
@@ -500,7 +500,7 @@ describe('scattermapbox convert', function() {
500500
'lon': [-73.57, -79.24, -123.06],
501501
'lat': [45.5, 43.4, 49.13],
502502
'text': ['Montreal', 'Toronto', 'Vancouver'],
503-
'texttemplate': '%{text} (%{lonlat[0]}, %{lonlat[1]}): %{customdata:.2s}',
503+
'texttemplate': '%{text} (%{lon}, %{lat}): %{customdata:.2s}',
504504
'textposition': 'top center',
505505
'customdata': [1780000, 2930000, 675218]
506506
};

0 commit comments

Comments
 (0)