Commit 5222ef3d authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl

dashboard only showing boxes if checkbox is checked. and Code cleaned up and

parent 4d4e3ab9
......@@ -4,10 +4,20 @@ library(jsonlite)
library(DT)
library(webshot)
server <- function(input, output, session) {
set.seed(122)
#DATA PAGE
#last coconut_name
output$lastLoadedNut<- renderText({
if (is.null(input$nut))
return(NULL)
else lastCoConUT
})
#CoConUT Data import and showing into data site
#CoConUT Data import
output$nut <- renderDataTable({
inFile <- input$nut
if (is.null(inFile))
......@@ -21,7 +31,6 @@ server <- function(input, output, session) {
print("coconut:")
print(coconut.df)
if(is.null(coconut.df$timestamp)){}
else{unixTime<<-coconut.df$timestamp}
......@@ -88,24 +97,23 @@ server <- function(input, output, session) {
class = 'cell-border stripe'
)
)
})
output$lastLoadedNut<- renderText({
if (is.null(input$nut))
#last cocoquest_name
output$lastLoadedQuest <- renderText({
if (is.null(input$quest))
return(NULL)
else lastCoConUT
else lastCoCoQuest
})
output$questTimes <- renderDataTable({
#CoCoQuest Data import
output$quest <- renderDataTable({
inFile <- input$quest
if (is.null(inFile))
return(NULL)
#loading CoCoQuest data
json_data_quest <<- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE)
......@@ -122,23 +130,11 @@ server <- function(input, output, session) {
endtimes <<- c(anytime(dat$endtime/1000))
tasks <- rep(1:length(json_data_quest$tasks$data), sapply(json_data_quest$tasks$data, nrow))
#count<<-0
# y <<-1
# x<<-1
#numOfTasks <<- if(tasks[x]!=y)
# {
# count<<-count+1
# y<<-y+1
# x<<-x+1
#}
#else{x<<-x+1}
together <<- c(tasks, endtimes)
#all <<- matrix(c(tasks,endtimes),byrow=FALSE,nrow=length(tasks))
all <- rbind(together)
all <- rbind(together)
#setting the table style
datatable(
cbind(tasks, endtimes),
......@@ -149,15 +145,8 @@ server <- function(input, output, session) {
)
)
})
#CoCOQuest Data import and showing into data site
output$lastLoadedQuest <- renderText({
if (is.null(input$quest))
return(NULL)
else lastCoCoQuest
})
#cocoQuest Starttime
output$totalStarttime <- renderText({
if (is.null(input$quest))
return(NULL)
......@@ -165,11 +154,13 @@ server <- function(input, output, session) {
print(totalStarttime)
})
#CONTROLLS PAGE
#Title Input
output$text <- renderText({ input$title })
output$check_histogram <- renderPrint({input$checkbox_hist })
#Histogram
#Not sure if so smart but it should work that way --> mit if schaun welches ausgewählt worden ist und die daten dann für dashboard ausgeben
output$input_hist_x <- renderUI({
if (is.null(input$nut))
return(NULL)
......@@ -182,8 +173,9 @@ server <- function(input, output, session) {
selectInput("in2", "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$check_time <- renderUI({checkboxInput("timeline", "Timeline", FALSE) })
#Timeline
output$input_time_x <- renderUI({
if (is.null(input$nut))
return(NULL)
......@@ -196,8 +188,9 @@ server <- function(input, output, session) {
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)
})
output$check_map <- renderUI({checkboxInput("map", "Map", FALSE) })
#Map
output$input_map_x <- renderUI({
if (is.null(input$nut))
return(NULL)
......@@ -210,8 +203,9 @@ server <- function(input, output, session) {
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$check_line <- renderUI({checkboxInput("linegraph", "Linegraph", FALSE) })
#Linegraph
output$input_line_x <- renderUI({
if (is.null(input$nut))
return(NULL)
......@@ -226,9 +220,54 @@ server <- function(input, output, session) {
#download dashboard button
#DASHBOARD PAGE
#HISTOGRAM
output$hist_box <- renderUI({
if(input$check_hist)
box( title="Histogram",
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot1", height = 250))
})
#TIMELINE
output$time_box <- renderUI({
if(input$check_time)
box( title="Timeline",
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot1", height = 250))
})
#MAP
output$map_box <- renderUI({
if(input$check_map)
box( title="Map",
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot1", height = 250))
})
#LINEGRAPH
output$line_box <- renderUI({
if(input$check_line)
box( title="Linegraph",
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot1", height = 250))
})
#DownloadButton
#TODO: MAKE IT WORK!
observeEvent(input$screenshot,{
webshot::install_phantomjs()
cdat <<- session$clientData
#print(cdat)
url <- paste0(cdat$url_protocol,"//",cdat$url_hostname,":", cdat$url_port, cdat$url_pathname,cdat$url_search)
......@@ -247,6 +286,14 @@ server <- function(input, output, session) {
#}
#)
#SOME STUFF
#histdata <- rnorm(500)
#output$plot1 <- renderPlot({
......
......@@ -58,7 +58,7 @@ ui <- dashboardPage(
textOutput("lastLoadedQuest"),
h4("Starttime: "),
textOutput("totalStarttime"),
dataTableOutput("questTimes")
dataTableOutput("quest")
),
......@@ -67,16 +67,21 @@ ui <- dashboardPage(
tabItem(tabName = "controlls",
h2("Controlls here:"),
textInput("title", "Title", " "),
checkboxInput("checkbox_hist", label = "Histogram", value = FALSE),
#HISTOGRAM
checkboxInput("check_hist", "Histogram", FALSE),
#uiOutput("check_hist"),
uiOutput("input_hist_x"),
uiOutput("input_hist_y"),
uiOutput("check_time"),
#TIMELINE
checkboxInput("check_time", "Timeline", FALSE),
uiOutput("input_time_x"),
uiOutput("input_time_y"),
uiOutput("check_map"),
#MAP
checkboxInput("check_map", "Map", FALSE),
uiOutput("input_map_x"),
uiOutput("input_map_y"),
uiOutput("check_line"),
#LINEGRAPH
checkboxInput("check_line", "Linegraph", FALSE),
uiOutput("input_line_x"),
uiOutput("input_line_y")
),
......@@ -93,27 +98,12 @@ ui <- dashboardPage(
#tabPanel("Tab2", "Tab content 2")
#),
#if(verbatimTextOutput("check_histogram")){
box( title="Histogram",
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot1", height = 250)),
# },
box(title="Map",
status = "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("plot2", height = 250)),
box(title="Timeline",
status = "warning",
solidHeader = TRUE,
collapsible = TRUE,plotOutput("plot3", height = 250)),
box(title="Linechart",
status = "warning",
solidHeader = TRUE,
collapsible = TRUE,plotOutput("plot4", height = 250))
uiOutput("hist_box"),
uiOutput("time_box"),
uiOutput("map_box"),
uiOutput("line_box")
),
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