Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Awesome Markers clash with shiny icons in dashboard #102

Open
fcecinati opened this issue Mar 11, 2020 · 0 comments
Open

Awesome Markers clash with shiny icons in dashboard #102

fcecinati opened this issue Mar 11, 2020 · 0 comments

Comments

@fcecinati
Copy link

I encountered a problem with awesome markers interacting with other shiny app icons: I am using Font Awesome icons for tabs in a dashboard application. When the app loads, the tab icons are rendering correctly. However, once the awesome markers are loaded the tab icons disappear. Note I'm using Font Awesome icons for the markers as well.
Here I include two snapshots of the behaviour, a reproducible example (you may need to adjust the number of points to create sufficient delay), and my session info:

image
image

library(tidyverse)
library(magrittr)
library(shiny)
library(shinydashboard)
library(shinyWidgets)
library(shinycssloaders)
library(shinydashboardPlus)
library(leaflet)
library(leaflet.extras)
library(sf)
library(sp)

points <- tibble(ID=c(1:2000),
                 Lat=53+runif(2000, 0, 1),
                 Lon=runif(2000, 0, 1))

points %<>%
    st_as_sf(coords=c('Lon', 'Lat'), crs=4326)

# Define UI
ui <- dashboardPage(

    dashboardHeader(title = "App"),

    dashboardSidebar(
        sidebarMenu(
            menuItem("Map", tabName = "Map", icon = icon("map-marked-alt", lib="font-awesome")),
            menuItem("Other tab", tabName = "Other", icon = icon("volume-up", lib="font-awesome")),
            menuItem("Third tab", tabName = "Third", icon = icon("file-medical-alt", lib="font-awesome"))
        )
    ),

    dashboardBody(
        tabItems(
            tabItem(
                tabName = "Map",
                # Map box
                boxPlus(width=12,
                        height=800,
                        status='warning',
                        withSpinner(leafletOutput("Network", height = 750))
                        )
                )
            )
        )
)

server <- function(input, output) {

    # Calculate bounding box
    bb <- reactive({
        points %>%
            as(., 'Spatial') %>%
            .@bbox %>%
            unname
    })

    # Map
    output$Network <- renderLeaflet({

        Icon <- awesomeIcons(icon = 'circle', iconColor = 'black', library = 'fa', markerColor = 'lightgreen')
        leaflet(options = providerTileOptions(minZoom = 1, maxZoom = 32)) %>%
            addTiles() %>% 
            addAwesomeMarkers(data=points, icon=Icon, label=~ID, layerId=~ID) %>%
            fitBounds(lng1=bb()[1,1], lat1=bb()[2,1], lng2=bb()[1,2], lat2=bb()[2,2])
    })
}

# Run the application 
shinyApp(ui = ui, server = server)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant