plotly / plotly/plotly.R

Mapbox "fitBounds" handling

Open
#2,255 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

As per https://github.com/plotly/plotly.R/blob/9ee548023bba6d68dd953f46485b2e611026766b/inst/htmlwidgets/plotly.js#L206-L220

I believe the if(!args) check should be changed (or the parameter for args should default to null or some other calculated default, not {}) as it currently causes an "e is undefined" error in mapbox (where e is the 2nd parameter).

I've got around it by explicitly providing a mapbox = list(_fitBounds = list(c(xmin, ymin), c(xmax, ymax)), options = list()) entry in my plotly::layout call.

This also serves as a reminder that the fitBounds doesn't seem to work for restyle either.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with inst/htmlwidgets/plotly.js lines 206-220, focusing on the fitBounds argument default and the Mapbox call that produces the undefined second-parameter error. Reproduce the issue with and without an explicit mapbox options list, then verify that fitBounds also works during restyle.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.