mapdeck icon indicating copy to clipboard operation
mapdeck copied to clipboard

mapdeck in flexdashbord

Open einarhjorleifsson opened this issue 4 years ago • 10 comments

Describe the bug The mapdeck map does not fill in the full "page" within flexdashboard Screenshot from 2020-03-18 17-16-40

To Reproduce run document: ftp://ftp.hafro.is/pub/reiknid/einar/test.Rmd

Expected behaviour Same as what appears under the Leaflet-tab when test.Rmd is run

Versions What version of mapdeck are you using

> packageVersion("mapdeck")
[1] ‘0.2.1006’

e

einarhjorleifsson avatar Mar 18 '20 17:03 einarhjorleifsson

@einarhjorleifsson Do you happen to know which css values make the leaflet full screen?

SymbolixAU avatar Mar 18 '20 20:03 SymbolixAU

not a clue, sorry e

einarhjorleifsson avatar Mar 18 '20 20:03 einarhjorleifsson

You need

.mapdeckmap {
     height: 100%;
}

trafficonese avatar Mar 19 '20 07:03 trafficonese

@trafficonese that didn't work for me.

dcooley avatar Mar 20 '20 00:03 dcooley

What if you use 100% !important instead? It worked for me without !important in the browser, but not in the RStudio Viewer.

trafficonese avatar Mar 20 '20 07:03 trafficonese

@trafficonese Where are you setting this value?

dcooley avatar Mar 25 '20 07:03 dcooley

I was just setting it in the browser inspector. But I think this should do it for the markdown:

---
title: "trial"
runtime: shiny
output: 
  flexdashboard::flex_dashboard:
    css: styles.css
---

and the styles.css is in the same directory and contains:

.mapdeckmap {
     height: 100% !important;
}

trafficonese avatar Mar 25 '20 08:03 trafficonese

ok yeah, i have it working in flexdashboard using

.mapdeckmap {
     height: 100% !important;
}

but this doesn't work for shiny - it makes the map disappear

dcooley avatar Mar 25 '20 08:03 dcooley

Indeed, interesting.

In shiny I thought it would work by setting mapdeckOutput("map", height = "100%") which should achieve the same thing. Apparently setting the height to any percentage doesnt work, you have to specify the height in px.

trafficonese avatar Mar 25 '20 08:03 trafficonese

@trafficonese when I had the same issue with leaflet in shiny, it turns out that the map has padding to its parent container (I was using tabbox)

Screen Shot 2020-04-20 at 18 55 11

so when you specify 100% it does give you all 100% that it can give under the limitation of padding etc., while if you specify px (or vw) it is able to force the size to go beyond the parent container and the limitations

wendywangwwt avatar Apr 20 '20 22:04 wendywangwwt