Commit 2935ac86 authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl

barchart working with selected data and svenjas dataset, first trys of...

barchart working with selected data and svenjas dataset, first trys of timeline and minor comments and renaming things
parent 2e722c28
...@@ -7,6 +7,7 @@ library(knitr) ...@@ -7,6 +7,7 @@ library(knitr)
library(leaflet) library(leaflet)
library(mapview) library(mapview)
library(ggplot2) library(ggplot2)
library(timevis)
server <- function(input, output, session) { server <- function(input, output, session) {
...@@ -37,6 +38,8 @@ server <- function(input, output, session) { ...@@ -37,6 +38,8 @@ server <- function(input, output, session) {
#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("HERE!!!!!!")
print(as.numeric(coconut.df[["timestamp"]]))
#print(coconut.df) #print(coconut.df)
if(is.null(coconut.df$timestamp)){} if(is.null(coconut.df$timestamp)){}
...@@ -178,7 +181,7 @@ server <- function(input, output, session) { ...@@ -178,7 +181,7 @@ server <- function(input, output, session) {
}) })
#CONTROLLS PAGE #View PAGE
#Title Input #Title Input
output$title <- renderText({ input$title }) output$title <- renderText({ input$title })
...@@ -187,7 +190,7 @@ server <- function(input, output, session) { ...@@ -187,7 +190,7 @@ server <- function(input, output, session) {
output$input_hist_x <- renderUI({ output$input_hist_x <- renderUI({
if (is.null(input$nut)) if (is.null(input$nut))
return(NULL) return(NULL)
selectInput("in1", "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) selectInput("in1", "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)
}) })
...@@ -201,12 +204,12 @@ server <- function(input, output, session) { ...@@ -201,12 +204,12 @@ server <- function(input, output, session) {
#Timeline #Timeline
output$input_time_x <- renderUI({ output$input_time_x <- renderUI({
if (is.null(input$nut)) if (is.null(input$nut))
return(NULL) return(NULL)
selectInput("in3", "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) selectInput("in3", "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_time_y <- renderUI({ output$input_time_y <- renderUI({
if (is.null(input$nut)) if (is.null(input$nut))
return(NULL) return(NULL)
selectInput("in4", "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("in4", "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)
...@@ -219,17 +222,18 @@ server <- function(input, output, session) { ...@@ -219,17 +222,18 @@ server <- function(input, output, session) {
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", "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({ output$input_map_x <- 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("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)
})
#linechart #linechart
...@@ -241,7 +245,7 @@ server <- function(input, output, session) { ...@@ -241,7 +245,7 @@ server <- function(input, output, session) {
}) })
output$input_line_y <- renderUI({ output$input_line_y <- renderUI({
if (is.null(input$nut)) if (is.null(input$nut))
return(NULL) return(NULL)
selectInput("in8", "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("in8", "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)
}) })
...@@ -266,30 +270,45 @@ server <- function(input, output, session) { ...@@ -266,30 +270,45 @@ server <- function(input, output, session) {
plotOutput("hist", height = 250)) plotOutput("hist", height = 250))
}) })
#HIS VIEW #BAR VIEW
output$hist <- renderPlot({ output$hist <- renderPlot({
print("hist wird aufgerufen")
a=1
for(a in 1:length(coconut.df$bluetooth.numOfBTDevices)){ print("x")
print(input$bar_x)
data<- structure(list(V1=as.numeric(coconut.df[[input$bar_y]]),
V2=as.numeric(coconut.df[[input$bar_x]])),
.Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
print("y")
print(data$V1)
#Neues Plot
barplot(data$V1,data$V2,
ylab= input$bar_y,
xlab=input$bar_x)
## ALTES PLOT
#a=1
#for(a in 1:length(coconut.df$bluetooth.numOfBTDevices)){
#g <-geom_bar(mapping = NULL, data = , stat = "count", #g <-geom_bar(mapping = NULL, data = , stat = "count",
# position = "stack", width = NULL, binwidth = NULL, na.rm = FALSE, # position = "stack", width = NULL, binwidth = NULL, na.rm = FALSE,
# show.legend = NA, inherit.aes = TRUE) # show.legend = NA, inherit.aes = TRUE)
g <- ggplot(coconut.df, aes("timestamp","bluetooth")) #g <- ggplot(coconut.df, aes("timestamp","bluetooth"))
#g + geom_bar() #g + geom_bar()
a=a+1} # a=a+1}
g #g
#hist(bluetooth) #hist(bluetooth)
}) })
...@@ -297,6 +316,43 @@ server <- function(input, output, session) { ...@@ -297,6 +316,43 @@ server <- function(input, output, session) {
output$time_box <- renderUI({ output$time_box <- renderUI({
if(input$check_time) if(input$check_time)
box( title="Timeline", box( title="Timeline",
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("time", height = 250))
})
#Timelineview
output$time <- renderPlot({
print("TIME wird aufgerufen")
timevisOutput("timeline")
})
#linechart
output$line_box <- renderUI({
if(input$check_line)
box( title="Linechart",
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot1", height = 250))
})
#TODO: Scatterplot
output$scat_box <- renderUI({
if(input$check_scat)
box( title="Scatterplot",
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot1", height = 250))
})
#TODO: Boxplot
output$box_box <- renderUI({
if(input$check_box)
box( title="Boxplot",
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
...@@ -326,15 +382,7 @@ server <- function(input, output, session) { ...@@ -326,15 +382,7 @@ server <- function(input, output, session) {
}) })
#linechart
output$line_box <- renderUI({
if(input$check_line)
box( title="Linechart",
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot1", height = 250))
})
...@@ -344,9 +392,11 @@ server <- function(input, output, session) { ...@@ -344,9 +392,11 @@ server <- function(input, output, session) {
#if(input$check_line|input$check_time|input$check_map|input$check_hist) #if(input$check_line|input$check_time|input$check_map|input$check_hist)
#disable("screenshot") #disable("screenshot")
#webshot::install_phantomjs() #webshot::install_phantomjs()
cdat <<- session$clientData cdat <<- session$clientData
url <- paste0(cdat$url_hostname,":", cdat$url_port,"/") url <- paste0(cdat$url_hostname,":", cdat$url_port,"/")
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,delay = 5.0) #webshot(url,delay = 5.0)
......
...@@ -76,23 +76,43 @@ ui <- dashboardPage( ...@@ -76,23 +76,43 @@ ui <- dashboardPage(
tabPanel("Barchart", tabPanel("Barchart",
#Barchart #Barchart
checkboxInput("check_hist", "Barchart", FALSE), checkboxInput("check_hist", "Barchart", FALSE),
#uiOutput("check_hist"), selectInput("bar_x", "x-axis", choices=colnames(coconut.df)),
uiOutput("input_hist_x"), selectInput("bar_y", "y-axis", choices=colnames(coconut.df))
uiOutput("input_hist_y")), #uiOutput("input_hist_x"),
#uiOutput("input_hist_y")
),
#TIMELINE #TIMELINE
tabPanel("Timeline", tabPanel("Timeline",
checkboxInput("check_time", "Timeline", FALSE), checkboxInput("check_time", "Timeline", FALSE),
uiOutput("input_time_x"), selectInput("time_data", "data", choices=colnames(coconut.df))
uiOutput("input_time_y")), #uiOutput("input_time_x"),
#uiOutput("input_time_y")
),
#Linechart #Linechart
tabPanel("Linechart", tabPanel("Linechart",
checkboxInput("check_line", "Linechart", FALSE), checkboxInput("check_line", "Linechart", FALSE),
uiOutput("input_line_x"), selectInput("line_x", "x-axis", choices=colnames(coconut.df)),
uiOutput("input_line_y")), selectInput("line_y", "y-axis", choices=colnames(coconut.df))
#uiOutput("input_line_x"),
#uiOutput("input_line_y")
),
#Scatterplot
tabPanel("Scatterplot",
checkboxInput("check_scat", "Scatterplot", FALSE),
selectInput("scat_x", "x-axis", choices=colnames(coconut.df)),
selectInput("scat_y", "y-axis", choices=colnames(coconut.df))
),
#Boxplot
tabPanel("Boxplot",
checkboxInput("check_box", "Boxplot", FALSE),
selectInput("box_x", "x-axis", choices=colnames(coconut.df)),
selectInput("box_y", "y-axis", choices=colnames(coconut.df))
),
#MAP #MAP
tabPanel("Map", tabPanel("Map",
checkboxInput("check_map", "Map", FALSE), checkboxInput("check_map", "Map", FALSE),
uiOutput("input_map")) selectInput("map_data", "data", choices=colnames(coconut.df))
)
) )
), ),
mainPanel(column(width = 12, mainPanel(column(width = 12,
...@@ -102,6 +122,8 @@ ui <- dashboardPage( ...@@ -102,6 +122,8 @@ ui <- dashboardPage(
uiOutput("hist_box"), uiOutput("hist_box"),
uiOutput("time_box"), uiOutput("time_box"),
uiOutput("line_box"), uiOutput("line_box"),
uiOutput("scat_box"),
uiOutput("box_box"),
uiOutput("map_box"), uiOutput("map_box"),
actionButton("screenshot","Download"))) actionButton("screenshot","Download")))
......
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