I'm trying to include a packedbubble chart built using the highcharter library in a shiny app. It works like a charm when I deploy the app locally:
but when I deploy the same app to shinyapps.io, it, well, get's completely messed up (for lack of a better description). So the chart's not displayed and the UI fluidPage()
set up is effectively ignored:
Sure, I wouldn't need highcharter for this simplified example. But this is just a boiled-down version of a more complex app, where I use clicks on the chart as a further input for the app.
The source code of the self-contained simplified app above reads:
library(shiny)
library(tidyverse)
library(highcharter)
library(gapminder)
# Define the UI
ui <- fluidPage(
title = "MockUp",
tags$head(
tags$style(
# css formating for the headers
HTML(".title-bar {
color: #cd003a;
}
.welltitle {
color: #cd003a;
font-weight: bold;
font-size: 1.5em;
text-align: center;
}")
)
),
# title of the entire app
titlePanel(
h1("MockUp Trial: Some grand standing title", class = "title-bar")
),
# app layout
fluidRow(
# one row with two columns taking 1/4 and 3/4 of the window width respectively
column(width = 3,
wellPanel(
# a place holder for a short text explaining how the app works
h4("Notes"),
htmlOutput("explainer"),
hr()
)
),
column(width = 9,
# the interactive packed bubble chart
highchartOutput("hcontainer", height = "500px")
)
),
fluidRow(
column(width = 12,
htmlOutput("disclaimer"))
)
)
# Define the server
server <- function(input, output) {
# Sample data
data(gapminder, package = "gapminder")
gapminder <- gapminder %>%
filter(year == max(year)) %>%
select(country, pop, continent)
q95 <- as.numeric(quantile(gapminder$pop, .95))
output$hcontainer <- renderHighchart({
hchart(gapminder, "packedbubble",
hcaes(name = country, value = pop, group = continent)) %>%
hc_tooltip(
useHTML = TRUE,
pointFormat = "<b>{point.name}:</b> {point.value}"
) %>%
hc_plotOptions(
packedbubble = list(
maxSize = "150%",
zMin = 0,
layoutAlgorithm = list(
gravitationalConstant = 0.05,
splitSeries = TRUE, # TRUE to group points
seriesInteraction = TRUE,
dragBetweenSeries = TRUE,
parentNodeLimit = TRUE
),
dataLabels = list(
enabled = TRUE,
format = "{point.name}",
filter = list(
property = "y",
operator = ">",
value = q95
),
style = list(
color = "black",
textOutline = "none",
fontWeight = "normal"
)
)
)
)
})
output$disclaimer <- renderUI({
HTML("<h4>Disclaimer</h4><br>Data based on the <a href=https://cran.r-project.org/web/packages/gapminder/readme/README.html target='_blank'> gapminder data set</a>.
The visualisation is taken directly from the <a href=https://jkunst.com/highcharter/articles/highcharts.html#packedbubble target='_blank'> highcharter website</a>.")
})
# Explanatory text about the app
output$explainer<- renderUI({
HTML("Welcome!<br>Just take a look at this awesome visualisation!<br>
Isn't it beautiful?")
})
}
# Run the app
shinyApp(ui = ui, server = server)
In deployment, I get the following warning message:
Error detecting locale: Error in make.names(col.names, unique = TRUE): invalid multibyte string 10 (using default: en_US)
The app's log file:
2023-05-09T13:28:25.640376+00:00 shinyapps[9065623]: reticulate version: (none)
2023-05-09T13:28:25.640568+00:00 shinyapps[9065623]: Using pandoc: /opt/connect/ext/pandoc/2.16
2023-05-09T13:28:26.001926+00:00 shinyapps[9065623]: Starting R with process ID: '64'
2023-05-09T13:28:26.002260+00:00 shinyapps[9065623]: Shiny application starting ...
2023-05-09T13:28:26.953542+00:00 shinyapps[9065623]: ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
2023-05-09T13:28:26.953587+00:00 shinyapps[9065623]: ✔ dplyr 1.1.2 ✔ readr 2.1.4
2023-05-09T13:28:26.953592+00:00 shinyapps[9065623]: ✔ forcats 1.0.0 ✔ stringr 1.5.0
2023-05-09T13:28:26.953595+00:00 shinyapps[9065623]: ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
2023-05-09T13:28:26.953598+00:00 shinyapps[9065623]: ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
2023-05-09T13:28:26.953602+00:00 shinyapps[9065623]: ✔ purrr 1.0.1
2023-05-09T13:28:27.061902+00:00 shinyapps[9065623]: ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
2023-05-09T13:28:27.061939+00:00 shinyapps[9065623]: ✖ dplyr::filter() masks stats::filter()
2023-05-09T13:28:27.061955+00:00 shinyapps[9065623]: ✖ dplyr::lag() masks stats::lag()
2023-05-09T13:28:27.061958+00:00 shinyapps[9065623]: ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
2023-05-09T13:28:27.294178+00:00 shinyapps[9065623]: Registered S3 method overwritten by 'quantmod':
2023-05-09T13:28:27.294215+00:00 shinyapps[9065623]: method from
2023-05-09T13:28:27.294222+00:00 shinyapps[9065623]: as.zoo.data.frame zoo
2023-05-09T13:28:27.558792+00:00 shinyapps[9065623]: Highcharts (www.highcharts.com) is a Highsoft software product which is
2023-05-09T13:28:27.558826+00:00 shinyapps[9065623]: not free for commercial and Governmental use
2023-05-09T13:28:27.630887+00:00 shinyapps[9065623]: Listening on http://127.0.0.1:43467
2023-05-09T13:52:23.201739+00:00 shinyapps[9065623]: Running on host: de546b4901ae
2023-05-09T13:52:23.204936+00:00 shinyapps[9065623]: Running as user: uid=10001(shiny) gid=10001(shiny) groups=10001(shiny)
2023-05-09T13:52:23.204959+00:00 shinyapps[9065623]: Connect version: 2023.03.0
2023-05-09T13:52:23.204963+00:00 shinyapps[9065623]: LANG: C.UTF-8
2023-05-09T13:52:23.204967+00:00 shinyapps[9065623]: Working directory: /srv/connect/apps/MoreHCTrials
2023-05-09T13:52:23.205118+00:00 shinyapps[9065623]: Using R 4.3.0
2023-05-09T13:52:23.205135+00:00 shinyapps[9065623]: R.home(): /opt/R/4.3.0/lib/R
2023-05-09T13:52:23.205344+00:00 shinyapps[9065623]: Content will use current R environment
2023-05-09T13:52:23.205353+00:00 shinyapps[9065623]: R_LIBS: (unset)
2023-05-09T13:52:23.205368+00:00 shinyapps[9065623]: .libPaths(): /opt/R/4.3.0/lib/R/library
2023-05-09T13:52:23.232242+00:00 shinyapps[9065623]: shiny version: 1.7.4
2023-05-09T13:52:23.232263+00:00 shinyapps[9065623]: httpuv version: 1.6.10
2023-05-09T13:52:23.232277+00:00 shinyapps[9065623]: rmarkdown version: 2.21
2023-05-09T13:52:23.232281+00:00 shinyapps[9065623]: knitr version: 1.42
2023-05-09T13:52:23.232284+00:00 shinyapps[9065623]: jsonlite version: 1.8.4
2023-05-09T13:52:23.232292+00:00 shinyapps[9065623]: RJSONIO version: (none)
2023-05-09T13:52:23.232295+00:00 shinyapps[9065623]: htmltools version: 0.5.5
2023-05-09T13:52:23.232298+00:00 shinyapps[9065623]: reticulate version: (none)
2023-05-09T13:52:23.232459+00:00 shinyapps[9065623]: Using pandoc: /opt/connect/ext/pandoc/2.16
2023-05-09T13:52:23.553720+00:00 shinyapps[9065623]: Starting R with process ID: '467'
2023-05-09T13:52:23.554146+00:00 shinyapps[9065623]: Shiny application starting ...
2023-05-09T13:52:24.398255+00:00 shinyapps[9065623]: ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
2023-05-09T13:52:24.398283+00:00 shinyapps[9065623]: ✔ dplyr 1.1.2 ✔ readr 2.1.4
2023-05-09T13:52:24.398290+00:00 shinyapps[9065623]: ✔ forcats 1.0.0 ✔ stringr 1.5.0
2023-05-09T13:52:24.398293+00:00 shinyapps[9065623]: ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
2023-05-09T13:52:24.398297+00:00 shinyapps[9065623]: ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
2023-05-09T13:52:24.398308+00:00 shinyapps[9065623]: ✔ purrr 1.0.1
2023-05-09T13:52:24.500892+00:00 shinyapps[9065623]: ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
2023-05-09T13:52:24.500909+00:00 shinyapps[9065623]: ✖ dplyr::filter() masks stats::filter()
2023-05-09T13:52:24.500914+00:00 shinyapps[9065623]: ✖ dplyr::lag() masks stats::lag()
2023-05-09T13:52:24.500917+00:00 shinyapps[9065623]: ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
2023-05-09T13:52:24.744583+00:00 shinyapps[9065623]: Registered S3 method overwritten by 'quantmod':
2023-05-09T13:52:24.744607+00:00 shinyapps[9065623]: method from
2023-05-09T13:52:24.744623+00:00 shinyapps[9065623]: as.zoo.data.frame zoo
2023-05-09T13:52:25.061024+00:00 shinyapps[9065623]: Listening on http://127.0.0.1:38321
2023-05-09T13:52:25.608310+00:00 shinyapps[9065623]: R: src/unix/core.c:258: uv__finish_close: Assertion `handle->flags & UV_HANDLE_CLOSING' failed.
tells me on the last line that some handle failed R: src/unix/core.c:258: uv__finish_close: Assertion
handle->flags & UV_HANDLE_CLOSING' failed.`
I cannot say with any certainty that the problem is linked to highcharter
, but deploying the standard Old Faithful
app works without a problem. Google unfortunately turns up next to nothing on this. And chatGPT seems likewise lost ...
Has anyone come across a similar issue and - even better - found a solution?
Thanks in advance