8000 Add bounds to mapbox subplot by archmoj · Pull Request #6339 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Add bounds to mapbox subplot #6339

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

Merged
merged 5 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
8000 Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revise defaults
  • Loading branch information
archmoj committed Oct 7, 2022
commit 4b95bbdaa0fc2b10c070671cbaa0e989a81dd968
24 changes: 16 additions & 8 deletions src/plots/mapbox/layout_attributes.js
8000
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,31 @@ var attrs = module.exports = overrideAll({

westbound: {
valType: 'number',
dflt: null,
description: 'Sets the minimum longitude of the map (in degrees East).'
description: [
'Sets the minimum longitude of the map (in degrees East)',
'if `eastbound`, `southbound` and `northbound` are declared.'
].join(' ')
},
eastbound: {
valType: 'number',
dflt: null,
description: 'Sets the maximum longitude of the map (in degrees East).'
description: [
'Sets the maximum longitude of the map (in degrees East)',
'if `westbound`, `southbound` and `northbound` are declared.'
].join(' ')
},
southbound: {
valType: 'number',
dflt: null,
description: 'Sets the minimum latitude of the map (in degrees North).'
description: [
'Sets the minimum latitude of the map (in degrees North)',
'if `eastbound`, `westbound` and `northbound` are declared.'
].join(' ')
},
northbound: {
valType: 'number',
dflt: null,
description: 'Sets the maximum latitude of the map (in degrees North).'
description: [
'Sets the maximum latitude of the map (in degrees North)',
'if `eastbound`, `westbound` and `southbound` are declared.'
].join(' ')
},

layers: templatedArray('layer', {
Expand Down
19 changes: 15 additions & 4 deletions src/plots/mapbox/layout_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,21 @@ function handleDefaults(containerIn, containerOut, coerce, opts) {
coerce('bearing');
coerce('pitch');

coerce('westbound');
coerce('eastbound');
coerce('southbound');
coerce('northbound');
var westbound = coerce('westbound');
var eastbound = coerce('eastbound');
var southbound = coerce('southbound');
var northbound = coerce('northbound');
if(
westbound === undefined ||
eastbound === undefined ||
southbound === undefined ||
northbound === undefined
) {
delete containerOut.westbound;
delete containerOut.eastbound;
delete containerOut.southbound;
delete containerOut.northbound;
}

handleArrayContainerDefaults(containerIn, containerOut, {
name: 'layers',
Expand Down
2 changes: 2 additions & 0 deletions src/plots/mapbox/mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
var southbound = opts.southbound;
var northbound = opts.northbound;
var maxBounds = (
/*
westbound !== undefined &&
eastbound !== undefined &&
southbound !== undefined &&
*/
northbound !== undefined
) ? [[westbound, southbound], [eastbound, northbound]] : null;

Expand Down
12 changes: 4 additions & 8 deletions test/plot-schema.json
8000
Original file line number Diff line number Diff line change
Expand Up @@ -3087,8 +3087,7 @@
}
},
"eastbound": {
"description": "Sets the maximum longitude of the map (in degrees East).",
"dflt": null,
"description": "Sets the maximum longitude of the map (in degrees East) if `westbound`, `southbound` and `northbound` are declared.",
"editType": "plot",
"valType": "number"
},
Expand Down Expand Up @@ -3313,8 +3312,7 @@
"role": "object"
},
"northbound": {
"description": "Sets the maximum latitude of the map (in degrees North).",
"dflt": null,
"description": "Sets the maximum latitude of the map (in degrees North) if `eastbound`, `westbound` and `southbound` are declared.",
"editType": "plot",
"valType": "number"
},
Expand All @@ -3326,8 +3324,7 @@
},
"role": "object",
"southbound": {
"description": "Sets the minimum latitude of the map (in degrees North).",
"dflt": null,
"description": "Sets the minimum latitude of the map (in degrees North) if `eastbound`, `westbound` and `northbound` are declared.",
"editType": "plot",
"valType": "number"
},
Expand Down Expand Up @@ -3359,8 +3356,7 @@
"valType": "any"
},
"westbound": {
"description": "Sets the minimum longitude of the map (in degrees East).",
"dflt": null,
"description": "Sets the minimum longitude of the map (in degrees East) if `eastbound`, `southbound` and `northbound` are declared.",
"editType": "plot",
"valType": "number"
},
Expand Down
0