Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add deprecation warning for mapbox traces and mapbox subplot #7087

Merged
merged 8 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions draftlogs/7087_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- deprecate mapbox traces and mapbox subplot [[#7087](https://github.com/plotly/plotly.js/pull/7087)]
13 changes: 13 additions & 0 deletions src/plots/mapbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@ exports.idRoot = MAPBOX;

exports.idRegex = exports.attrRegex = Lib.counterRegex(MAPBOX);

var deprecationWarning = [
'mapbox subplots and traces are deprecated!',
'Please consider switching to `map` subplots and traces.'
].join(' ');

exports.attributes = {
subplot: {
valType: 'subplotid',
dflt: 'mapbox',
editType: 'calc',
description: [
deprecationWarning,
'Sets a reference between this trace\'s data coordinates and',
'a mapbox subplot.',
'If *mapbox* (the default value), the data refer to `layout.mapbox`.',
Expand All @@ -43,7 +49,14 @@ exports.layoutAttributes = require('./layout_attributes');

exports.supplyLayoutDefaults = require('./layout_defaults');

var firstPlot = true;

exports.plot = function plot(gd) {
if(firstPlot) {
firstPlot = false;
Lib.warn(deprecationWarning);
}

var fullLayout = gd._fullLayout;
var calcData = gd.calcdata;
var mapboxIds = fullLayout._subplots[MAPBOX];
Expand Down
6 changes: 6 additions & 0 deletions src/traces/choroplethmapbox/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
'use strict';

var deprecationWarning = [
'*choroplethmapbox* trace is deprecated!',
'Please consider switching to the *choroplethmap* trace type and `map` subplots.'
archmoj marked this conversation as resolved.
Show resolved Hide resolved
].join(' ');

module.exports = {
attributes: require('./attributes'),
supplyDefaults: require('./defaults'),
Expand Down Expand Up @@ -48,6 +53,7 @@ module.exports = {
meta: {
hr_name: 'choropleth_mapbox',
description: [
deprecationWarning,
'GeoJSON features to be filled are set in `geojson`',
'The data that describes the choropleth value-to-color mapping',
'is set in `locations` and `z`.'
Expand Down
6 changes: 6 additions & 0 deletions src/traces/densitymapbox/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
'use strict';

var deprecationWarning = [
'*densitymapbox* trace is deprecated!',
'Please consider switching to the *densitymap* trace type and `map` subplots.'
].join(' ');

module.exports = {
attributes: require('./attributes'),
supplyDefaults: require('./defaults'),
Expand Down Expand Up @@ -33,6 +38,7 @@ module.exports = {
meta: {
hr_name: 'density_mapbox',
description: [
deprecationWarning,
'Draws a bivariate kernel density estimation with a Gaussian kernel',
'from `lon` and `lat` coordinates and optional `z` values using a colorscale.'
].join(' ')
Expand Down
6 changes: 6 additions & 0 deletions src/traces/scattermapbox/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
'use strict';

var deprecationWarning = [
'*scattermapbox* trace is deprecated!',
'Please consider switching to the *scattermap* trace type and `map` subplots.'
].join(' ');

module.exports = {
attributes: require('./attributes'),
supplyDefaults: require('./defaults'),
Expand All @@ -25,6 +30,7 @@ module.exports = {
meta: {
hrName: 'scatter_mapbox',
description: [
deprecationWarning,
'The data visualized as scatter point, lines or marker symbols',
'on a Mapbox GL geographic map',
'is provided by longitude/latitude pairs in `lon` and `lat`.'
Expand Down
12 changes: 6 additions & 6 deletions test/plot-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29751,7 +29751,7 @@
}
},
"subplot": {
"description": "Sets a reference between this trace's data coordinates and a mapbox subplot. If *mapbox* (the default value), the data refer to `layout.mapbox`. If *mapbox2*, the data refer to `layout.mapbox2`, and so on.",
"description": "mapbox subplots and traces are deprecated! Please consider switching to `map` subplots and traces. Sets a reference between this trace's data coordinates and a mapbox subplot. If *mapbox* (the default value), the data refer to `layout.mapbox`. If *mapbox2*, the data refer to `layout.mapbox2`, and so on.",
"dflt": "mapbox",
"editType": "calc",
"valType": "subplotid"
Expand Down Expand Up @@ -29865,7 +29865,7 @@
"showLegend"
],
"meta": {
"description": "GeoJSON features to be filled are set in `geojson` The data that describes the choropleth value-to-color mapping is set in `locations` and `z`.",
"description": "*choroplethmapbox* trace is deprecated! Please consider switching to the *choroplethmap* trace type and `map` subplots. GeoJSON features to be filled are set in `geojson` The data that describes the choropleth value-to-color mapping is set in `locations` and `z`.",
archmoj marked this conversation as resolved.
Show resolved Hide resolved
"hr_name": "choropleth_mapbox"
},
"type": "choroplethmapbox"
Expand Down Expand Up @@ -37184,7 +37184,7 @@
}
},
"subplot": {
"description": "Sets a reference between this trace's data coordinates and a mapbox subplot. If *mapbox* (the default value), the data refer to `layout.mapbox`. If *mapbox2*, the data refer to `layout.mapbox2`, and so on.",
"description": "mapbox subplots and traces are deprecated! Please consider switching to `map` subplots and traces. Sets a reference between this trace's data coordinates and a mapbox subplot. If *mapbox* (the default value), the data refer to `layout.mapbox`. If *mapbox2*, the data refer to `layout.mapbox2`, and so on.",
"dflt": "mapbox",
"editType": "calc",
"valType": "subplotid"
Expand Down Expand Up @@ -37282,7 +37282,7 @@
"showLegend"
],
"meta": {
"description": "Draws a bivariate kernel density estimation with a Gaussian kernel from `lon` and `lat` coordinates and optional `z` values using a colorscale.",
"description": "*densitymapbox* trace is deprecated! Please consider switching to the *densitymap* trace type and `map` subplots. Draws a bivariate kernel density estimation with a Gaussian kernel from `lon` and `lat` coordinates and optional `z` values using a colorscale.",
"hr_name": "density_mapbox"
},
"type": "densitymapbox"
Expand Down Expand Up @@ -80422,7 +80422,7 @@
}
},
"subplot": {
"description": "Sets a reference between this trace's data coordinates and a mapbox subplot. If *mapbox* (the default value), the data refer to `layout.mapbox`. If *mapbox2*, the data refer to `layout.mapbox2`, and so on.",
"description": "mapbox subplots and traces are deprecated! Please consider switching to `map` subplots and traces. Sets a reference between this trace's data coordinates and a mapbox subplot. If *mapbox* (the default value), the data refer to `layout.mapbox`. If *mapbox2*, the data refer to `layout.mapbox2`, and so on.",
"dflt": "mapbox",
"editType": "calc",
"valType": "subplotid"
Expand Down Expand Up @@ -80580,7 +80580,7 @@
"scatter-like"
],
"meta": {
"description": "The data visualized as scatter point, lines or marker symbols on a Mapbox GL geographic map is provided by longitude/latitude pairs in `lon` and `lat`.",
"description": "*scattermapbox* trace is deprecated! Please consider switching to the *scattermap* trace type and `map` subplots. The data visualized as scatter point, lines or marker symbols on a Mapbox GL geographic map is provided by longitude/latitude pairs in `lon` and `lat`.",
"hrName": "scatter_mapbox"
},
"type": "scattermapbox"
Expand Down