R Leaflet does not show legend when embedded in Shiny Dashboard - r

The map above renders perfectly fine in the following scenarios:
List item
RStudio Viewer
Shiny app
Shiny app using a minimal Shiny dashboard sceleton
When including the map in an existing, pretty complex Shiny dashboard, the looks as follows:
Obviously, the legend is missing. On top of that, the "reset view" action button has no effect.
Without posting the complete code of the complex shiny dashbboard, I would like make the following comments:
I have disabled all custom JS code and CSS
I use a bare "renderLeaflet" function without additional arguments
I have also tried to display the leaflet in a bare dashboard box without any further arguments
Any obvious culprit anyone could think of causing this issue? Anyone observed similar issues?

I wonder if you solved the issue. I noticed the legend of a raster layer disappears when using the function d3heatmap, for instance d3heatmap(mtcars, scale="column", colors="Blues"). When the line with the heatmap is commented out the dashboard knites just fine -even when the library d3heatmap is loaded. I used the code from this example. Oh I just noticed this has been addressed and solved in other questions, for example here.

Related

Rshiny - Plotly Add watermark logo to plot only if download initiated

I am building a shiny app and in this app I have a plot and I decided to use renderPlotly and ggplotly to render it.
Using this link, it is fairly easy to create a watermark to a ggplotly plot.
However, I want this watermark to be generated only on the downloaded png version of my plot and not on the one rendered that users see while using the app.
Is this possible ? I thought about disabling he download button and using the download handler to generate a new plot with a watermark, but it seems very complicated and not at all efficient looking at this question
Any help ?

Shiny - How can I tell when graphs are done rendering programmatically?

I am an old hand at R, but new to Shiny. (It is very cool!)
I am rendering graphs using ggplot2 in Shiny, and it works great. The only thing is that after my ggplot executes and I issue a renderPlot, there is a delay before the graphs display. I am fine with the delay, but I would like to know in the program after the graphs render. I hit the bottom of my code and the graphs are still rendering in the background.
Any advice is appreciated.
Lou
https://cran.r-project.org/web/packages/shinybusy/vignettes/shinybusy-usage.html
Check this out! You can add a busy spinner and then every time your graph is being rendered, you will be able to understand with the indicator.

Create a Menu inside a Menu in flexdashboard - R

I'm creating a Dashboard in R with flexdashboard. I have a drop down menu (See Image 1). I want to create a menu inside the menu (See Image 2). It is possible with this library?
Unfortunately, there is no easy way to do this just with the regular flexdashboard commands. The only alternatives I see:
Shiny + Flexdashboard
You can combine Flexdashboard with Shiny in order to add this submenus (consider this possibility).
Tabsets
If you don't need to show so many charts/plots in this sub-submenu's pages, a possibility that might suit you is combining the dropdown menu option with tab-panels in the main page. Please check Flexdashboard Layout documentation (btw, it's also possible with shiny)
Editing Flexdashboard CSS/HTML code
I am not really sure about it but, as you can change the color or resize the text editing the CSS-HTML code, you should be able to do what it (remember you can add your own custom CSS file). Try to look for web page front-end solutions to what you are looking for and try to edit the code by your own. Maybe this would help you
Sorry for this poorly edited answer, this is my first answer in stackoverflow.

googleCharts resets in size in Shiny after second load

So I'm using the googleCharts package in my Shiny app and creating a line chart.
I have a function that creates a different kind of main panel with tabsetpanel depending on the options the user selects. The first load works fine, but when I switch options in my app and it loads the main panel page the second time, the chart shrinks in size unless I specify an exact height and width in options.
The interesting part is if I select the options so the main panel that's created doesn't have a chart, then select one that does, it resets and works fine again. So it's almost like some kind of reactive problem where its saving the wrong page size and not doing a full load.
Any ideas on what I could do? Is there a way for me to force a refresh/reload of the mainPanel?
I actually ended up solving this using invalidateLater, but I would appreciate it if there's a different solution too, since the user can see the chart being redrawn with this solution

How to set scrollWheelZoom to false in a map using leaflet in Shiny?

I am using Shiny to build an application using the leaflet library.
I create the map at the ui.R using leafletOutput() and render it at server.R using renderLeaflet(). I can add markers, set zooming factor, etc. Everything works like a charm.
The problem is that I cannot find a way to set scrollWheelZoom to false. I really need this.
Any ideas?
As stated by Yihui on the comment above, there is no way to do it.
I filled an issue at leaflet to ask this feature: https://github.com/rstudio/leaflet/issues/84
Tks

Resources