Commit b98c9128 authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl

Barchart (with selected data)

Map and Timeline (not selecting data) working

first trys with scatterplot and linechart
parent 2935ac86
...@@ -8,6 +8,7 @@ library(leaflet) ...@@ -8,6 +8,7 @@ library(leaflet)
library(mapview) library(mapview)
library(ggplot2) library(ggplot2)
library(timevis) library(timevis)
library(plotly)
server <- function(input, output, session) { server <- function(input, output, session) {
...@@ -38,8 +39,7 @@ server <- function(input, output, session) { ...@@ -38,8 +39,7 @@ 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)){}
...@@ -133,11 +133,12 @@ server <- function(input, output, session) { ...@@ -133,11 +133,12 @@ server <- function(input, output, session) {
#unix parsed #unix parsed
dat <- do.call(rbind, json_data_quest$tasks$data) dat <- do.call(rbind, json_data_quest$tasks$data)
endtimes <<- c(anytime(dat$endtime)) endtimes <<- c(dat$endtime)
parsedEndtimes <<- anytime(endtimes/1000)
#endtimes <<- format(dat$endtime, format="%d-%B-%Y %H:%M:%S") #endtimes <<- format(dat$endtime, format="%d-%B-%Y %H:%M:%S")
print("endtime quest") print("endtime quest")
print(endtimes) print(parsedEndtimes)
tasks <- rep(1:length(json_data_quest$tasks$data), sapply(json_data_quest$tasks$data, nrow)) tasks <- rep(1:length(json_data_quest$tasks$data), sapply(json_data_quest$tasks$data, nrow))
#questions #questions
#print("Questions:", questions) #print("Questions:", questions)
...@@ -272,17 +273,11 @@ server <- function(input, output, session) { ...@@ -272,17 +273,11 @@ server <- function(input, output, session) {
#BAR VIEW #BAR VIEW
output$hist <- renderPlot({ output$hist <- renderPlot({
print("BAR wird aufgerufen.")
print("x") print(coconut.df)
print(input$bar_x)
data<- structure(list(V1=as.numeric(coconut.df[[input$bar_y]]), data<- structure(list(V1=as.numeric(coconut.df[[input$bar_y]]),
V2=as.numeric(coconut.df[[input$bar_x]])), V2=as.numeric(coconut.df[[input$bar_x]])),
.Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame") .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
print("y")
print(data$V1)
#Neues Plot #Neues Plot
barplot(data$V1,data$V2, barplot(data$V1,data$V2,
ylab= input$bar_y, ylab= input$bar_y,
...@@ -303,12 +298,8 @@ server <- function(input, output, session) { ...@@ -303,12 +298,8 @@ server <- function(input, output, session) {
# a=a+1} # a=a+1}
#g #g
#hist(bluetooth) #hist(bluetooth)
}) })
...@@ -319,15 +310,32 @@ server <- function(input, output, session) { ...@@ -319,15 +310,32 @@ server <- function(input, output, session) {
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
plotOutput("time", height = 250)) timevisOutput("time", height = 250)
)
}) })
#Timelineview #TODO: Timelineview
output$time <- renderPlot({ output$time <- renderTimevis({
print("TIME wird aufgerufen") print("TIME wird aufgerufen")
timevisOutput("timeline")
print("Length:")
print(length(parsedEndtimes))
print("combined")
print( c(anytime(totalST), head(parsedEndtimes, -1)))
print("endtimes")
print(parsedEndtimes)
data <- data.frame(
id = 1:length(parsedEndtimes),
content= c(1:length(parsedEndtimes)),
start = c(anytime(totalST), head(parsedEndtimes, -1)),
end = parsedEndtimes
)
timevis(data)
}) })
#linechart #linechart
output$line_box <- renderUI({ output$line_box <- renderUI({
...@@ -336,27 +344,48 @@ server <- function(input, output, session) { ...@@ -336,27 +344,48 @@ server <- function(input, output, session) {
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
plotOutput("plot1", height = 250)) plotOutput("line", height = 250))
})
#TODO: linechart View
output$line <- renderPlot({
print("LINE wird aufgerufen")
}) })
#TODO: Scatterplot # Scatterplot
output$scat_box <- renderUI({ output$scat_box <- renderUI({
if(input$check_scat) if(input$check_scat)
box( title="Scatterplot", box( title="Scatterplot",
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
plotOutput("plot1", height = 250)) plotOutput("scat", height = 250))
}) })
#TODO: Boxplot #TODO: Scatterplot View
output$scat <- renderPlot({
data<- structure(list(V1=as.numeric(coconut.df[[input$scat_y]]),
V2=as.numeric(coconut.df[[input$scat_x]])),
.Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
print("SCAT wird aufgerufen")
plot(data, x= data$V2, y= data$V1, type="p")
})
# Boxplot
output$box_box <- renderUI({ output$box_box <- renderUI({
if(input$check_box) if(input$check_box)
box( title="Boxplot", box( title="Boxplot",
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
plotOutput("plot1", height = 250)) plotOutput("box", height = 250))
})
#TODO: Boxplot View
output$box <- renderPlot({
print("BOX wird aufgerufen")
}) })
#MAP #MAP
...@@ -371,7 +400,7 @@ server <- function(input, output, session) { ...@@ -371,7 +400,7 @@ server <- function(input, output, session) {
# MAP VIEW # MAP VIEW
output$map <- renderLeaflet({ output$map <- renderLeaflet({
print("map wird aufgerufen") print("MAP wird aufgerufen")
m <<- leaflet() m <<- leaflet()
x=1 x=1
m <- addTiles(m) m <- addTiles(m)
......
...@@ -121,6 +121,7 @@ ui <- dashboardPage( ...@@ -121,6 +121,7 @@ ui <- dashboardPage(
uiOutput("hist_box"), uiOutput("hist_box"),
uiOutput("time_box"), uiOutput("time_box"),
#timevisOutput("time"),
uiOutput("line_box"), uiOutput("line_box"),
uiOutput("scat_box"), uiOutput("scat_box"),
uiOutput("box_box"), uiOutput("box_box"),
......
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