Skip to content

Commit f7f3190

Browse files
committed
sort all choroplethmapbox traces below scattermapbox traces
... similar to how we do things on geo subplots
1 parent 5d27983 commit f7f3190

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/plots/mapbox/mapbox.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,25 @@ proto.updateMap = function(calcData, fullLayout, resolve, reject) {
308308
});
309309
};
310310

311+
var traceType2orderIndex = {
312+
'choroplethmapbox': 0,
313+
'scattermapbox': 1
314+
};
315+
311316
proto.updateData = function(calcData) {
312317
var traceHash = this.traceHash;
313318
var traceObj, trace, i, j;
314319

320+
var calcDataSorted = calcData.slice().sort(function(a, b) {
321+
return (
322+
traceType2orderIndex[a[0].trace.type] -
323+
traceType2orderIndex[b[0].trace.type]
324+
);
325+
});
326+
315327
// update or create trace objects
316-
for(i = 0; i < calcData.length; i++) {
317-
var calcTrace = calcData[i];
328+
for(i = 0; i < calcDataSorted.length; i++) {
329+
var calcTrace = calcDataSorted[i];
318330

319331
trace = calcTrace[0].trace;
320332
traceObj = traceHash[trace.uid];

0 commit comments

Comments
 (0)