From 040bdc110b6c3950d5e3599ddd3fcbac02bc85a5 Mon Sep 17 00:00:00 2001 From: Emily KL <4672118+emilykl@users.noreply.github.com> Date: Fri, 8 Aug 2025 15:17:31 -0400 Subject: [PATCH] only show locationmode warning if locationmode is 'country names' --- src/traces/choropleth/defaults.js | 10 ++++++++++ src/traces/choropleth/plot.js | 11 ----------- src/traces/scattergeo/defaults.js | 10 ++++++++++ src/traces/scattergeo/plot.js | 11 ----------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/traces/choropleth/defaults.js b/src/traces/choropleth/defaults.js index b6b1a82e418..af94097d5a0 100644 --- a/src/traces/choropleth/defaults.js +++ b/src/traces/choropleth/defaults.js @@ -4,6 +4,12 @@ var Lib = require('../../lib'); var colorscaleDefaults = require('../../components/colorscale/defaults'); var attributes = require('./attributes'); +const locationmodeBreakingChangeWarning = [ + 'The library used by the *country names* `locationmode` option is changing in the next major version.', + 'Some country names in existing plots may not work in the new version.', + 'To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.', +].join(' '); + module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); @@ -28,6 +34,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout var locationMode = coerce('locationmode', locationmodeDflt); + if(locationMode === 'country names') { + Lib.warn(locationmodeBreakingChangeWarning); + } + if(locationMode === 'geojson-id') { coerce('featureidkey'); } diff --git a/src/traces/choropleth/plot.js b/src/traces/choropleth/plot.js index bf99852986c..da27bf17d78 100644 --- a/src/traces/choropleth/plot.js +++ b/src/traces/choropleth/plot.js @@ -9,18 +9,7 @@ var findExtremes = require('../../plots/cartesian/autorange').findExtremes; var style = require('./style').style; -const breakingChangeWarning = [ - 'The library used by the *country names* `locationmode` option is changing in an upcoming version.', - 'Country names in existing plots may not work in the new version.' -].join(' '); -let firstPlot = true; - function plot(gd, geo, calcData) { - if(firstPlot) { - firstPlot = false; - Lib.warn(breakingChangeWarning); - } - var choroplethLayer = geo.layers.backplot.select('.choroplethlayer'); Lib.makeTraceGroups(choroplethLayer, calcData, 'trace choropleth').each(function(calcTrace) { diff --git a/src/traces/scattergeo/defaults.js b/src/traces/scattergeo/defaults.js index 6f8adb11d98..f2a1ad9b9d8 100644 --- a/src/traces/scattergeo/defaults.js +++ b/src/traces/scattergeo/defaults.js @@ -10,6 +10,12 @@ var handleFillColorDefaults = require('../scatter/fillcolor_defaults'); var attributes = require('./attributes'); +const locationmodeBreakingChangeWarning = [ + 'The library used by the *country names* `locationmode` option is changing in the next major version.', + 'Some country names in existing plots may not work in the new version.', + 'To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.', +].join(' '); + module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); @@ -27,6 +33,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout var locationMode = coerce('locationmode', locationmodeDflt); + if(locationMode === 'country names') { + Lib.warn(locationmodeBreakingChangeWarning); + } + if(locationMode === 'geojson-id') { coerce('featureidkey'); } diff --git a/src/traces/scattergeo/plot.js b/src/traces/scattergeo/plot.js index 284bb0093d1..9124900e8b3 100644 --- a/src/traces/scattergeo/plot.js +++ b/src/traces/scattergeo/plot.js @@ -13,18 +13,7 @@ var calcMarkerSize = require('../scatter/calc').calcMarkerSize; var subTypes = require('../scatter/subtypes'); var style = require('./style'); -const breakingChangeWarning = [ - 'The library used by the *country names* `locationmode` option is changing in an upcoming version.', - 'Country names in existing plots may not work in the new version.' -].join(' '); -let firstPlot = true; - function plot(gd, geo, calcData) { - if(firstPlot) { - firstPlot = false; - Lib.warn(breakingChangeWarning); - } - var scatterLayer = geo.layers.frontplot.select('.scatterlayer'); var gTraces = Lib.makeTraceGroups(scatterLayer, calcData, 'trace scattergeo'); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy