Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 040bdc1

Browse files
committed
only show locationmode warning if locationmode is 'country names'
1 parent f4282e0 commit 040bdc1

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

‎src/traces/choropleth/defaults.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ var Lib = require('../../lib');
44
var colorscaleDefaults = require('../../components/colorscale/defaults');
55
var attributes = require('./attributes');
66

7+
const locationmodeBreakingChangeWarning = [
8+
'The library used by the *country names* `locationmode` option is changing in the next major version.',
9+
'Some country names in existing plots may not work in the new version.',
10+
'To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.',
11+
].join(' ');
12+
713
module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
814
function coerce(attr, dflt) {
915
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
@@ -28,6 +34,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
2834

2935
var locationMode = coerce('locationmode', locationmodeDflt);
3036

37+
if(locationMode === 'country names') {
38+
Lib.warn(locationmodeBreakingChangeWarning);
39+
}
40+
3141
if(locationMode === 'geojson-id') {
3242
coerce('featureidkey');
3343
}

‎src/traces/choropleth/plot.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,7 @@ var findExtremes = require('../../plots/cartesian/autorange').findExtremes;
99

1010
var style = require('./style').style;
1111

12-
const breakingChangeWarning = [
13-
'The library used by the *country names* `locationmode` option is changing in an upcoming version.',
14-
'Country names in existing plots may not work in the new version.'
15-
].join(' ');
16-
let firstPlot = true;
17-
1812
function plot(gd, geo, calcData) {
19-
if(firstPlot) {
20-
firstPlot = false;
21-
Lib.warn(breakingChangeWarning);
22-
}
23-
2413
var choroplethLayer = geo.layers.backplot.select('.choroplethlayer');
2514

2615
Lib.makeTraceGroups(choroplethLayer, calcData, 'trace choropleth').each(function(calcTrace) {

‎src/traces/scattergeo/defaults.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ var handleFillColorDefaults = require('../scatter/fillcolor_defaults');
1010

1111
var attributes = require('./attributes');
1212

13+
const locationmodeBreakingChangeWarning = [
14+
'The library used by the *country names* `locationmode` option is changing in the next major version.',
15+
'Some country names in existing plots may not work in the new version.',
16+
'To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.',
17+
].join(' ');
18+
1319
module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) {
1420
function coerce(attr, dflt) {
1521
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
@@ -27,6 +33,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
2733

2834
var locationMode = coerce('locationmode', locationmodeDflt);
2935

36+
if(locationMode === 'country names') {
37+
Lib.warn(locationmodeBreakingChangeWarning);
38+
}
39+
3040
if(locationMode === 'geojson-id') {
3141
coerce('featureidkey');
3242
}

‎src/traces/scattergeo/plot.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,7 @@ var calcMarkerSize = require('../scatter/calc').calcMarkerSize;
1313
var subTypes = require('../scatter/subtypes');
1414
var style = require('./style');
1515

16-
const breakingChangeWarning = [
17-
'The library used by the *country names* `locationmode` option is changing in an upcoming version.',
18-
'Country names in existing plots may not work in the new version.'
19-
].join(' ');
20-
let firstPlot = true;
21-
2216
function plot(gd, geo, calcData) {
23-
if(firstPlot) {
24-
firstPlot = false;
25-
Lib.warn(breakingChangeWarning);
26-
}
27-
2817
var scatterLayer = geo.layers.frontplot.select('.scatterlayer');
2918
var gTraces = Lib.makeTraceGroups(scatterLayer, calcData, 'trace scattergeo');
3019

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /