Skip to content

Commit

Permalink
small fix for north arrow
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-plutniak committed Jan 13, 2024
1 parent 7ca6a23 commit c14a173
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ app_server <- function(input, output, session) {
from.param.time.df <- utils::read.csv(url(as.character(query[['timeline.df']])))
} else {
from.param.time.df <- getShinyOption("timeline.df")
}
}


# sources priority:
Expand All @@ -146,6 +146,8 @@ app_server <- function(input, output, session) {
# notification disabled
# showNotification(.term_switcher(timeline$notif.text),
# type = timeline$notif.type)
if(is.null(timeline$data)){return()}

timeline$data
})

Expand Down Expand Up @@ -1198,6 +1200,7 @@ app_server <- function(input, output, session) {

# : slider timeline ----
output$sliderTimeline <- renderUI({
req(timeline.data)
time.df <- timeline.data()
if(is.null(time.df)) return()

Expand Down Expand Up @@ -1785,9 +1788,10 @@ app_server <- function(input, output, session) {
# Timeline ----
# : main timeline ----
timeline.map.plot <- reactive({
req(timeline.data)
time.df <- timeline.data()

if(is.null(time.df)) return()

time.sub.df <- time.df[time.df$year == input$history.date, ]

if(nrow(time.sub.df) == 0) return()
Expand Down Expand Up @@ -1821,7 +1825,7 @@ app_server <- function(input, output, session) {
timeline.map.out <- timeline.map.out +
theme(axis.text.y = element_blank())
}
# browser()

# : - add scale ----
timeline.map.out <- timeline.map.out +
annotate("text",
Expand All @@ -1842,7 +1846,7 @@ app_server <- function(input, output, session) {
ncol=2)

arrow.coords <- .rotate(coords = arrow.coords, # rotate arrow
degrees = getShinyOption("grid.orientation"),
degrees = 360 - getShinyOption("grid.orientation"),
pivot = c(arrow.x.origin,
median(c(arrow.coords[, 2])))
)
Expand All @@ -1863,7 +1867,9 @@ app_server <- function(input, output, session) {
timeline.map.out
})

output$timeline.map <- renderPlot({ timeline.map.plot() })
output$timeline.map <- renderPlot({
timeline.map.plot()
})

output$download.timeline.map <- downloadHandler(
filename = "timeline-map.svg",
Expand Down Expand Up @@ -1901,7 +1907,10 @@ app_server <- function(input, output, session) {
panel.grid.major = element_blank())
})

output$timeline.map.grid <- renderPlot({ timeline.map.grid()})
output$timeline.map.grid <- renderPlot({
req(timeline.map.grid)
timeline.map.grid()
})

output$download.timeline.map.grid <- downloadHandler(
filename = "timeline-map-grid.svg",
Expand Down
2 changes: 1 addition & 1 deletion R/do_map_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
arrow.coords <- matrix(c(.95, .95, .1, .04), ncol=2)

arrow.coords <- .rotate(coords = arrow.coords, # rotate arrow
degrees = 360 - grid.orientation,
degrees = grid.orientation,
pivot = c(.95, .07))
map <- layout(map,
annotations = list(
Expand Down

0 comments on commit c14a173

Please sign in to comment.