|
3 | 3 |
|
4 | 4 | from plotly.basedatatypes import BaseTraceType as _BaseTraceType
|
5 | 5 | import copy as _copy
|
| 6 | +import warnings |
6 | 7 |
|
7 | 8 |
|
8 | 9 | class Choropleth(_BaseTraceType):
|
@@ -370,7 +371,7 @@ def hovertemplate(self):
|
370 | 371 | Additionally, every attributes that can be specified per-point
|
371 | 372 | (the ones that are `arrayOk: true`) are available. Anything
|
372 | 373 | contained in tag `<extra>` is displayed in the secondary box,
|
373 |
| - for example "<extra>{fullData.name}</extra>". To hide the |
| 374 | + for example `<extra>%{fullData.name}</extra>`. To hide the |
374 | 375 | secondary box completely, use an empty tag `<extra></extra>`.
|
375 | 376 |
|
376 | 377 | The 'hovertemplate' property is a string and must be specified as:
|
@@ -594,11 +595,14 @@ def legendwidth(self, val):
|
594 | 595 | @property
|
595 | 596 | def locationmode(self):
|
596 | 597 | """
|
597 |
| - Determines the set of locations used to match entries in |
598 |
| - `locations` to regions on the map. Values "ISO-3", "USA- |
599 |
| - states", *country names* correspond to features on the base map |
600 |
| - and value "geojson-id" corresponds to features from a custom |
601 |
| - GeoJSON linked to the `geojson` attribute. |
| 598 | + The library used by the *country names* `locationmode` option |
| 599 | + is changing in an upcoming version. Country names in existing |
| 600 | + plots may not work in the new version. Determines the set of |
| 601 | + locations used to match entries in `locations` to regions on |
| 602 | + the map. Values "ISO-3", "USA-states", *country names* |
| 603 | + correspond to features on the base map and value "geojson-id" |
| 604 | + corresponds to features from a custom GeoJSON linked to the |
| 605 | + `geojson` attribute. |
602 | 606 |
|
603 | 607 | The 'locationmode' property is an enumeration that may be specified as:
|
604 | 608 | - One of the following enumeration values:
|
@@ -1196,8 +1200,9 @@ def _prop_descriptions(self):
|
1196 | 1200 | specified per-point (the ones that are `arrayOk: true`)
|
1197 | 1201 | are available. Anything contained in tag `<extra>` is
|
1198 | 1202 | displayed in the secondary box, for example
|
1199 |
| - "<extra>{fullData.name}</extra>". To hide the secondary |
1200 |
| - box completely, use an empty tag `<extra></extra>`. |
| 1203 | + `<extra>%{fullData.name}</extra>`. To hide the |
| 1204 | + secondary box completely, use an empty tag |
| 1205 | + `<extra></extra>`. |
1201 | 1206 | hovertemplatesrc
|
1202 | 1207 | Sets the source reference on Chart Studio Cloud for
|
1203 | 1208 | `hovertemplate`.
|
@@ -1241,12 +1246,15 @@ def _prop_descriptions(self):
|
1241 | 1246 | Sets the width (in px or fraction) of the legend for
|
1242 | 1247 | this trace.
|
1243 | 1248 | locationmode
|
1244 |
| - Determines the set of locations used to match entries |
1245 |
| - in `locations` to regions on the map. Values "ISO-3", |
1246 |
| - "USA-states", *country names* correspond to features on |
1247 |
| - the base map and value "geojson-id" corresponds to |
1248 |
| - features from a custom GeoJSON linked to the `geojson` |
1249 |
| - attribute. |
| 1249 | + The library used by the *country names* `locationmode` |
| 1250 | + option is changing in an upcoming version. Country |
| 1251 | + names in existing plots may not work in the new |
| 1252 | + version. Determines the set of locations used to match |
| 1253 | + entries in `locations` to regions on the map. Values |
| 1254 | + "ISO-3", "USA-states", *country names* correspond to |
| 1255 | + features on the base map and value "geojson-id" |
| 1256 | + corresponds to features from a custom GeoJSON linked to |
| 1257 | + the `geojson` attribute. |
1250 | 1258 | locations
|
1251 | 1259 | Sets the coordinates via location IDs or names. See
|
1252 | 1260 | `locationmode` for more info.
|
@@ -1515,8 +1523,9 @@ def __init__(
|
1515 | 1523 | specified per-point (the ones that are `arrayOk: true`)
|
1516 | 1524 | are available. Anything contained in tag `<extra>` is
|
1517 | 1525 | displayed in the secondary box, for example
|
1518 |
| - "<extra>{fullData.name}</extra>". To hide the secondary |
1519 |
| - box completely, use an empty tag `<extra></extra>`. |
| 1526 | + `<extra>%{fullData.name}</extra>`. To hide the |
| 1527 | + secondary box completely, use an empty tag |
| 1528 | + `<extra></extra>`. |
1520 | 1529 | hovertemplatesrc
|
1521 | 1530 | Sets the source reference on Chart Studio Cloud for
|
1522 | 1531 | `hovertemplate`.
|
@@ -1560,12 +1569,15 @@ def __init__(
|
1560 | 1569 | Sets the width (in px or fraction) of the legend for
|
1561 | 1570 | this trace.
|
1562 | 1571 | locationmode
|
1563 |
| - Determines the set of locations used to match entries |
1564 |
| - in `locations` to regions on the map. Values "ISO-3", |
1565 |
| - "USA-states", *country names* correspond to features on |
1566 |
| - the base map and value "geojson-id" corresponds to |
1567 |
| - features from a custom GeoJSON linked to the `geojson` |
1568 |
| - attribute. |
| 1572 | + The library used by the *country names* `locationmode` |
| 1573 | + option is changing in an upcoming version. Country |
| 1574 | + names in existing plots may not work in the new |
| 1575 | + version. Determines the set of locations used to match |
| 1576 | + entries in `locations` to regions on the map. Values |
| 1577 | + "ISO-3", "USA-states", *country names* correspond to |
| 1578 | + features on the base map and value "geojson-id" |
| 1579 | + corresponds to features from a custom GeoJSON linked to |
| 1580 | + the `geojson` attribute. |
1569 | 1581 | locations
|
1570 | 1582 | Sets the coordinates via location IDs or names. See
|
1571 | 1583 | `locationmode` for more info.
|
@@ -1697,6 +1709,15 @@ def __init__(
|
1697 | 1709 | constructor must be a dict or
|
1698 | 1710 | an instance of :class:`plotly.graph_objs.Choropleth`""")
|
1699 | 1711 |
|
| 1712 | + if locationmode == "country names" and kwargs.get("_validate"): |
| 1713 | + warnings.warn( |
| 1714 | + "The library used by the *country names* `locationmode` option is changing in an upcoming version. " |
| 1715 | + "Country names in existing plots may not work in the new version. " |
| 1716 | + "To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.", |
| 1717 | + DeprecationWarning, |
| 1718 | + stacklevel=5, |
| 1719 | + ) |
| 1720 | + |
1700 | 1721 | self._skip_invalid = kwargs.pop("skip_invalid", False)
|
1701 | 1722 | self._validate = kwargs.pop("_validate", True)
|
1702 | 1723 |
|
|
0 commit comments