-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
186 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ dev_history.R | |
$run_dev.* | ||
^LICENSE\.md$ | ||
^appveyor\.yml$ | ||
^Dockerfile$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
#' @import shiny | ||
app_server <- function(input, output, session) { | ||
utils::data("fopi", package = "fopi") | ||
|
||
echarts4r::e_common( | ||
font_family = "Playfair Display", | ||
theme = "vintage" | ||
) | ||
|
||
output$title <- typed::renderTyped({ | ||
typed::typed(c("Freedom of Fake news^1000", "Freedom of Press Index^500<br>A Visualisation"), typeSpeed = 25, smartBackspace = TRUE) | ||
}) | ||
|
||
callModule(mod_ts_server, "ts") | ||
callModule(mod_map_server, "map") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#' map UI Function | ||
#' | ||
#' @description A shiny Module. | ||
#' | ||
#' @param id,input,output,session Internal parameters for {shiny}. | ||
#' | ||
#' @noRd | ||
#' | ||
#' @importFrom shiny NS tagList | ||
mod_map_ui <- function(id){ | ||
ns <- NS(id) | ||
pageContainer( | ||
class = "light", | ||
h2("Scores through time"), | ||
shinyWidgets::radioGroupButtons( | ||
inputId = ns("value"), | ||
label = "Metric", | ||
choices = c("rank", "score"), | ||
checkIcon = list( | ||
yes = icon("ok", | ||
lib = "glyphicon") | ||
) | ||
), | ||
echarts4r::echarts4rOutput(ns("map"), height = "50vh"), | ||
uiOutput(ns("desc")) | ||
) | ||
} | ||
|
||
#' map Server Function | ||
#' | ||
#' @noRd | ||
mod_map_server <- function(input, output, session){ | ||
ns <- session$ns | ||
|
||
output$desc <- renderUI({ | ||
msg <- paste0(tools::toTitleCase(input$value), ", the lower (the darker) the better") | ||
|
||
tags$i(msg) | ||
}) | ||
|
||
output$map <- echarts4r::renderEcharts4r({ | ||
fopi %>% | ||
dplyr::mutate( | ||
year = gsub("^20", "", year), | ||
year = paste0("'", year) | ||
) %>% | ||
tidyr::drop_na(input$value) %>% | ||
echarts4r::e_country_names(country, country, type = "country.name") %>% | ||
dplyr::group_by(year) %>% | ||
echarts4r::e_charts(country, timeline = TRUE) %>% | ||
echarts4r::e_map_(input$value, name = "Index") %>% | ||
echarts4r::e_visual_map_( | ||
input$value, | ||
top = "middle", | ||
textStyle = list(color = "#fff"), | ||
outOfRange = list( | ||
color = "#2f2f2f" | ||
), | ||
inRange = list( | ||
color = c("#247BA0", "#70C1B3", "#B2DBBF") | ||
) | ||
) %>% | ||
echarts4r::e_color(background = "rgba(0,0,0,0)") %>% | ||
echarts4r::e_tooltip() %>% | ||
echarts4r::e_timeline_opts( | ||
playInterval = 600, | ||
currentIndex = 16, | ||
symbolSize = 4, | ||
label = list( | ||
color = "#f9f7f1" | ||
), | ||
checkpointStyle = list( | ||
color = "#f9f7f1" | ||
), | ||
lineStyle = list( | ||
color = "#f9f7f1" | ||
), | ||
controlStyle = list( | ||
color = "#f9f7f1", | ||
borderColor = "#f9f7f1" | ||
) | ||
) | ||
}) | ||
} | ||
|
||
## To be copied in the UI | ||
# mod_map_ui("map") | ||
|
||
## To be copied in the server | ||
# callModule(mod_map_server, "map") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM rocker/r-ver:3.6.0 | ||
RUN apt-get update && apt-get install -y git-core libcurl4-openssl-dev libssh2-1-dev libssl-dev libxml2-dev make zlib1g-dev && rm -rf /var/lib/apt/lists/* | ||
RUN echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl')" >> /usr/local/lib/R/etc/Rprofile.site | ||
RUN R -e 'install.packages("remotes")' | ||
RUN R -e 'remotes::install_github("r-lib/remotes", ref = "97bbf81")' | ||
RUN Rscript -e 'remotes::install_version("shiny",upgrade="never", version = "1.4.0")' | ||
RUN Rscript -e 'install.packages("golem",upgrade="never")' | ||
RUN Rscript -e 'remotes::install_version("dplyr",upgrade="never", version = "0.8.5")' | ||
RUN Rscript -e 'remotes::install_version("tidyr",upgrade="never", version = "1.0.2")' | ||
RUN Rscript -e 'remotes::install_version("magrittr",upgrade="never", version = "1.5")' | ||
RUN Rscript -e 'remotes::install_version("shinythemes",upgrade="never", version = "1.1.2")' | ||
RUN Rscript -e 'remotes::install_version("shinyWidgets",upgrade="never", version = "0.5.1")' | ||
RUN Rscript -e 'remotes::install_github("hadley/emo@3f03b11491ce3d6fc5601e210927eff73bf8e350")' | ||
RUN Rscript -e 'remotes::install_github("news-r/fopi@efce5c2c1361eb74f71251b58587d0963812a086")' | ||
RUN Rscript -e 'remotes::install_github("JohnCoene/typed@31e6d3be6a82486c891fbb615b83811cf698aa5a")' | ||
RUN Rscript -e 'remotes::install_github("RinteRface/fullPage@acc62332aeceaca5422643a2355790a1f2b942fa")' | ||
RUN Rscript -e 'remotes::install_github("JohnCoene/echarts4r@db1a1f30c50d4837540ce529c4d07f92079311d0")' | ||
RUN Rscript -e 'remotes::install_github("rstudio/promises@627dfc6a9189575265c744e700efcff4de94cd19")' | ||
RUN Rscript -e 'remotes::install_github("r-lib/usethis@942c09710174b2abbe0b26dd335e1ebe338f7b82")' | ||
RUN R -e 'remotes::install_github("news-r/fopi.app")' | ||
|
||
EXPOSE 3838 | ||
CMD ["R", "-e", "options('shiny.port'=3838,shiny.host='0.0.0.0');fopi.app::run_fopi()"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.