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

map first real approach

parent 82ee30ef
......@@ -5,6 +5,7 @@ library(DT)
library(webshot)
library(knitr)
library(leaflet)
library(mapview)
server <- function(input, output, session) {
......@@ -18,12 +19,7 @@ server <- function(input, output, session) {
})
#DATA PAGE
#last coconut_name
output$lastLoadedNut<- renderText({
if (is.null(input$nut))
return(NULL)
else lastCoConUT
})
#CoConUT Data import
output$nut <- renderDataTable({
......@@ -37,11 +33,11 @@ server <- function(input, output, session) {
lastCoConUT <<- inFile$name
print("coconut:")
#print("coconut:")
#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)){}
else{unixTime<<-coconut.df$timestamp}
......@@ -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
output$quest <- renderDataTable({
inFile <- input$quest
......@@ -120,15 +122,8 @@ server <- function(input, output, session) {
json_data_quest <<- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE)
lastCoCoQuest <<- inFile$name
#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")
totalST <<- c(anytime(as.numeric(json_data_quest$startTime)/1000))
#unix parsed
dat <- do.call(rbind, json_data_quest$tasks$data)
......@@ -167,7 +162,7 @@ server <- function(input, output, session) {
if (is.null(input$quest))
return(NULL)
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) {
#Map
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 <- renderUI({
if (is.null(input$nut))
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)
})
#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({
if (is.null(input$nut))
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)
})
# output$input_map_y <- renderUI({
# if (is.null(input$nut))
# 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)
#})
#Linegraph
......@@ -281,15 +280,17 @@ server <- function(input, output, session) {
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("map", height = 250))
leafletOutput("map", height = 250))
})
output$map <- renderPlot({
m <- leaflet()
# actual plot
output$map <- renderLeaflet({
print("wird aufgerufen")
m <<- leaflet()
x=1
m <- addTiles(m)
for(x in 1:length(coconut.df)){
m <- addMarkers(m,lng=in5[x], lat=in6[x]) #addPolylines does not work
for(x in 1:length(coconut.df$gps.latitude)){
m <- addMarkers(m,lng=as.numeric(longitude[x]), lat=as.numeric(latitude[x])) #addPolylines does not work
x=x+1}
m
})
......@@ -335,10 +336,24 @@ server <- function(input, output, session) {
print(url)
#URL <- "http://rstudio.github.io/leaflet/"
#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")
port <- cdat$url_port
#port <- cdat$url_port
#mapshot(m, file="~/Rplot.png")
#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)
......
......@@ -79,9 +79,9 @@ ui <- dashboardPage(
uiOutput("input_time_x"),
uiOutput("input_time_y"),
#MAP
checkboxInput("check_map", "Map", FALSE),
uiOutput("input_map_x"),
uiOutput("input_map_y"),
checkboxInput("check_map", "Map", TRUE),
uiOutput("input_map"),
#uiOutput("input_map_y"),
#LINEGRAPH
checkboxInput("check_line", "Linegraph", FALSE),
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