Commit 0ef40149 authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl

map first real approach

parent 82ee30ef
...@@ -5,6 +5,7 @@ library(DT) ...@@ -5,6 +5,7 @@ library(DT)
library(webshot) library(webshot)
library(knitr) library(knitr)
library(leaflet) library(leaflet)
library(mapview)
server <- function(input, output, session) { server <- function(input, output, session) {
...@@ -18,12 +19,7 @@ server <- function(input, output, session) { ...@@ -18,12 +19,7 @@ server <- function(input, output, session) {
}) })
#DATA PAGE #DATA PAGE
#last coconut_name
output$lastLoadedNut<- renderText({
if (is.null(input$nut))
return(NULL)
else lastCoConUT
})
#CoConUT Data import #CoConUT Data import
output$nut <- renderDataTable({ output$nut <- renderDataTable({
...@@ -37,11 +33,11 @@ server <- function(input, output, session) { ...@@ -37,11 +33,11 @@ server <- function(input, output, session) {
lastCoConUT <<- inFile$name lastCoConUT <<- inFile$name
print("coconut:") #print("coconut:")
#coconut.df$timestamp <- format(coconut.df$timestamp, format="%d-%B-%Y %H:%M:%S") #coconut.df$timestamp <- format(coconut.df$timestamp, format="%d-%B-%Y %H:%M:%S")
print(coconut.df) #print(coconut.df)
if(is.null(coconut.df$timestamp)){} if(is.null(coconut.df$timestamp)){}
else{unixTime<<-coconut.df$timestamp} else{unixTime<<-coconut.df$timestamp}
...@@ -109,7 +105,13 @@ server <- function(input, output, session) { ...@@ -109,7 +105,13 @@ server <- function(input, output, session) {
) )
) )
}) })
#last coconut_name
output$lastLoadedNut<- renderText({
if (is.null(input$nut))
return(NULL)
else lastCoConUT
})
#CoCoQuest Data import #CoCoQuest Data import
output$quest <- renderDataTable({ output$quest <- renderDataTable({
inFile <- input$quest inFile <- input$quest
...@@ -120,15 +122,8 @@ server <- function(input, output, session) { ...@@ -120,15 +122,8 @@ server <- function(input, output, session) {
json_data_quest <<- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE) json_data_quest <<- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE)
lastCoCoQuest <<- inFile$name lastCoCoQuest <<- inFile$name
totalST <<- c(anytime(as.numeric(json_data_quest$startTime)/1000))
#json_data_quest$unix_starttime <- as.numeric(json_data_quest$startTime)/1000
#json_data_quest$unix_endtime <- as.numeric(json_data_quest$endTime)/1000
#totalStarttime <<- anytime(c(json_data_quest$unix_starttime))
#totalEndtime <<- anytime(json_data_quest$unix_endtime)
#json_data_quest$unix_starttime <- format(json_data_quest$unix_starttime, format="%d-%B-%Y %H:%M:%S")
#unix parsed #unix parsed
dat <- do.call(rbind, json_data_quest$tasks$data) dat <- do.call(rbind, json_data_quest$tasks$data)
...@@ -167,7 +162,7 @@ server <- function(input, output, session) { ...@@ -167,7 +162,7 @@ server <- function(input, output, session) {
if (is.null(input$quest)) if (is.null(input$quest))
return(NULL) return(NULL)
else { else {
format(totalStarttime, format="%d-%B-%Y %H:%M:%S") format(totalST, format="%d-%B-%Y %H:%M:%S")
} }
}) })
...@@ -215,18 +210,22 @@ server <- function(input, output, session) { ...@@ -215,18 +210,22 @@ server <- function(input, output, session) {
#Map #Map
output$input_map <- renderUI({
output$input_map_x <- renderUI({ if (is.null(input$nut))
if (is.null(input$nut)) return(NULL)
return(NULL) selectInput("in5", "Data:", cbind("unixTime", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE)
selectInput("in5", "x-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) })
}) #output$input_map_x <- renderUI({
# if (is.null(input$nut))
# return(NULL)
# selectInput("in5", "x-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE)
#})
output$input_map_y <- renderUI({ # output$input_map_y <- renderUI({
if (is.null(input$nut)) # if (is.null(input$nut))
return(NULL) # return(NULL)
selectInput("in6", "y-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) # selectInput("in6", "y-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE)
}) #})
#Linegraph #Linegraph
...@@ -281,15 +280,17 @@ server <- function(input, output, session) { ...@@ -281,15 +280,17 @@ server <- function(input, output, session) {
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
plotOutput("map", height = 250)) leafletOutput("map", height = 250))
}) })
output$map <- renderPlot({ # actual plot
m <- leaflet() output$map <- renderLeaflet({
print("wird aufgerufen")
m <<- leaflet()
x=1 x=1
m <- addTiles(m) m <- addTiles(m)
for(x in 1:length(coconut.df)){ for(x in 1:length(coconut.df$gps.latitude)){
m <- addMarkers(m,lng=in5[x], lat=in6[x]) #addPolylines does not work m <- addMarkers(m,lng=as.numeric(longitude[x]), lat=as.numeric(latitude[x])) #addPolylines does not work
x=x+1} x=x+1}
m m
}) })
...@@ -335,10 +336,24 @@ server <- function(input, output, session) { ...@@ -335,10 +336,24 @@ server <- function(input, output, session) {
print(url) print(url)
#URL <- "http://rstudio.github.io/leaflet/" #URL <- "http://rstudio.github.io/leaflet/"
#appshot("cocoVisR/", file = "dashboard.png", port = getOption("shiny.port"), envvars = NULL) #appshot("cocoVisR/", file = "dashboard.png", port = getOption("shiny.port"), envvars = NULL)
#webshot(URL, "dashboard.png",delay = 5.0) #webshot(url,delay = 5.0)
#knit("dashboard.png") #knit("dashboard.png")
port <- cdat$url_port #port <- cdat$url_port
#mapshot(m, file="~/Rplot.png")
#webshot(url, "dashboard.png", delay = 20.0) # does NOT WORK #webshot(url, "dashboard.png", delay = 20.0) # does NOT WORK
#appdir <- system.file("examples", "01_hello", package="shiny")
#print("appdir")
#print(appdir)
#appshot(appdir, "01_hello.png")
leaflet.print(m)
}) })
# url <- paste0(cdat$url_protocol,"//",cdat$url_hostname,":", cdat$url_port, cdat$url_pathname,cdat$url_search) # url <- paste0(cdat$url_protocol,"//",cdat$url_hostname,":", cdat$url_port, cdat$url_pathname,cdat$url_search)
......
...@@ -79,9 +79,9 @@ ui <- dashboardPage( ...@@ -79,9 +79,9 @@ ui <- dashboardPage(
uiOutput("input_time_x"), uiOutput("input_time_x"),
uiOutput("input_time_y"), uiOutput("input_time_y"),
#MAP #MAP
checkboxInput("check_map", "Map", FALSE), checkboxInput("check_map", "Map", TRUE),
uiOutput("input_map_x"), uiOutput("input_map"),
uiOutput("input_map_y"), #uiOutput("input_map_y"),
#LINEGRAPH #LINEGRAPH
checkboxInput("check_line", "Linegraph", FALSE), checkboxInput("check_line", "Linegraph", FALSE),
uiOutput("input_line_x"), uiOutput("input_line_x"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment