Skip to content

Commit

Permalink
moved functions around, changed popup content
Browse files Browse the repository at this point in the history
  • Loading branch information
romunov committed Oct 6, 2017
1 parent b96e9dd commit 833e404
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ library(rgdal)
library(data.table)

source("global.R")
source("GKtoWGS.R")
source("functions.R")

#### HEADER ####

Expand Down
16 changes: 16 additions & 0 deletions GKtoWGS.R → functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,19 @@ GKtoWGS <- function(df) {
df
}
}


#' Create popup for samples.
populatePopup <- function(x) {
out <- sprintf("<dl>
<dt>animal: %s</dt>
<dt>date: %s</dt>
<dt>sex: %s</dt>
<dt>sample type: %s</dt>
</dl>",
x$animal,
x$date,
x$sex,
x$sample_type)
out
}
4 changes: 2 additions & 2 deletions leaflet.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ observe({
fillOpacity = 0.2,
fillColor = "black",
layerId = paste("allMarkers", xy$id, sep = " "),
popup = paste(xy$sample_type, "from", xy$animal, "on", xy$date, sep = " "))
popup = populatePopup(xy))


if (nrow(picks) > 0) {
Expand All @@ -53,7 +53,7 @@ observe({
fillColor = ~pal(sample_type),
fillOpacity = input$parent_opacity,
layerId = paste("aniMarkers", picks$id, sep = " "),
popup = paste(picks$sample_type, "from", picks$animal, "on", picks$date, sep = " "))
popup = populatePopup(picks))
}
}
})
Expand Down

0 comments on commit 833e404

Please sign in to comment.