flowmapblue.R icon indicating copy to clipboard operation
flowmapblue.R copied to clipboard

Add flowmapblue to quarto chunk

Open RobWiederstein opened this issue 1 year ago • 3 comments

I've got a quarto website where I'm trying to add the flowmapblue plot:

#| eval: TRUE
mapboxAccessToken <- Sys.getenv("MAPBOX")
flowmapblue(locations, flows, mapboxAccessToken,
            clustering = TRUE, darkMode = TRUE, animation = FALSE) -> flowmap 
flowmap

When the website renders, the plot is outside of the code block and the CSS on the page gets changed. I've tried to use it with function widgetframe::framewidget() but no luck. Any general ideas would be helpful. I'm confident it can be done, because I saw it on Professor Moraga's post: https://www.paulamoraga.com/blog/2020-07-11-mobility.html.

Many thanks and love the package! It works great from the console.

RobWiederstein avatar Oct 27 '24 14:10 RobWiederstein

Hi @RobWiederstein , I've recently noticed this problem too. I solved it with:

htmlwidgets::saveWidget(flowmap, "flowmap_widget.html")
library(shiny)
shiny::tags$iframe(src = "flowmap_widget.html", width = "100%", height = "600px")

So basically you have to dump the map into an html file and then paste it back as an iframe, sort of.

This is a workaround...

e-kotov avatar Oct 27 '24 14:10 e-kotov

Perfect! Worked great and thanks so much!

RobWiederstein avatar Oct 27 '24 17:10 RobWiederstein

Perhaps this should be addressed as a bug, as this is not normal behaviour for an htmlwidget, or at least we should reflect this in the documentation.

e-kotov avatar Oct 27 '24 19:10 e-kotov