R Shiny Leaflet - Adding Content to SidebarPanel based on click events - r

I'm working on a Shiny dashboard which is taking a shape file from my system and using leaflet to show some categorical variable (like winning party in an election).
In the main panel, I have the map, which is colored based on winning party.
In the sidebar panel, I want to display fields of any particular constituency which has been clicked upon in a particular formatting. I can't figure out how to do this. I would also like to introduce "zoom on click" features.
Working Dashboard - sidebarpanel on right with field to be filled which can be seen in popup
Any help will be appreciated. Thanks!
EDIT1: I was also able to pass a vector array as layerId in addPolygon function but don't know how to use the layerId to retrieve other attributes.

Solved to an extent:
I used htmloutput in ui.R. Using layerId accessed other vars and passed them through renderText in server.R

Related

An unwanted label appears around the leaflet map within shiny context

Using leaflet, I have created the below pretty map within the shiny context. As shown in the image below, a label within a box (Intelectual Disability) appears around the map. It disappears when I click somewhere on the page, however, I was wondering to know why this happens and how can I avoid this?
Thanks,
Nader

How to get submitButton to not take effect until after the initial loading of the R Shiny App?

I have a Shiny app that has widgets which control the out of a map.
There are several inputs.
I don't want the map to reload until the user has edited all of the inputs they want to edit.
Hence I have this line of code:
submitButton("Update Map", icon("refresh"))
in my UI, which only reloads the map if the user press on the button.
But now it won't load the initial map upon the launching of the app.
I want that behavior.
What do I need to change?

Display Buffering/Loading message in Shiny Dashboard

I have done Shiny dashboard with 4 different tabs in the Side panel. It's all working perfectly fine. The only thing is, the fourth tab is a plotly output. When I click the tab, it should display the entire US county map.
It takes nearly 30 seconds to load the map after the tab button is clicked. Until that the screen just displays the empty body background. Is there anyway I could add a buffering/loading message that gets displayed in the body until the map is loaded? So that the user knows that the map is being loaded.. Thanks
Alternate to the progress bar there are few things you can do in this regard.
library(shinycssloaders)
usage:
withSpinner(plotOutput("my_plot"))
plotOutput("my_plot") %>% withSpinner()
If it takes 30 secs you may want to look into the Asynchronous concept in Rshiny Conference. Joe Cheng talk
probably this is still probably work in progress, but you can find alternate options will be available.

Dynamic tab with dynamic select input option- R shiny

I am developing a shiny application. It is almost completed.
I need to hide one tab dynamically. But this tab also has one dynamic selectInput option.
I am able to only hide a tab when it does not have any dynamic input selection.
Here I am confused that if in UI part I am using for example:
htmlOutput("selectUI"))
for Dynamic tab then where should I mention
htmlOutput("selectUI1"))
for dynamic selectInput option.
Please assist. Let me know if you need more information.

Controlling reactivity in Shiny

I have a Shiny Dashboard that has 4 tabs that display 4 different plots. The last plot is a 3 D Plotly plot. It is parameter driven which are provided by two input text controls and one select box. It works fine, but it is quite slow.
Therefore, I am trying to control its reactivity by putting an submitButton next to the parameter controls so that it is redrawn only when the user clicks the submitButton. Trouble is: it affects the other three plots as well. Is there a way to control the reactivity so that it only affects the desired plot?

Resources