Skip to content

Commit

Permalink
Feature/67 fix color order (#71)
Browse files Browse the repository at this point in the history
* fix colour order (#67)

* Temporarily delete cached library

As it was produced with R 4.x

* Fix re-installation of remotes after library rm

* Need Rscript to re-install remotes

* Revert flushing the R library cache

* Restore original indention

Co-authored-by: Riccardo Porreca <riccardo.porreca@mirai-solutions.com>
Co-authored-by: Guido Maggio <GuidoMaggio@users.noreply.github.com>
  • Loading branch information
3 people authored May 23, 2020
1 parent e360f8f commit cd77f8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Covid19 1.1.6.9000 (development version)

- Fix colour order in mod_lineplots_day_contagion (#67)
- Merge the two boxes for current and new values into one.(#69)
- fix trend order of area plot both global and country tabs, added utils funtion (#74)
- correct plot titles for modules mod_compare_nth_cases_plot and mod_growth_death_rate (#66)
Expand Down
13 changes: 12 additions & 1 deletion R/mod_lineplots_day_contagion.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,24 @@ mod_lineplots_day_contagion_ui <- function(id){
mod_lineplots_day_contagion_server <- function(input, output, session, countries_data){
ns <- session$ns

countries_ordered <- reactive({
countries_data() %>%
group_by(Country.Region) %>%
filter(date == max(date)) %>%
filter(confirmed == max(confirmed)) %>%
ungroup() %>%
arrange(desc(confirmed)) %>%
select(Country.Region) %>%
pull()
})

statuses <- c("confirmed", "deaths", "recovered", "active")
output$line_plot_day_contagion <- renderPlot({
df <- countries_data() %>%
select(statuses, date, Country.Region) %>%
arrange(date) %>%
pivot_longer(cols = -c(date, Country.Region), names_to = "status", values_to = "value") %>%
mutate(Country.Region = as.factor(Country.Region)) %>%
mutate(Country.Region = factor(Country.Region, levels = countries_ordered())) %>%
mutate(status = factor(status, levels = statuses))


Expand Down

0 comments on commit cd77f8a

Please sign in to comment.