Commit 82d4e992 authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl

multiple barcharts first try

parent f5e5da56
...@@ -11,8 +11,10 @@ library(timevis) ...@@ -11,8 +11,10 @@ library(timevis)
library(plotly) library(plotly)
server <- function(input, output, session) { server <- function(input, output, session) {
set.seed(122) set.seed(122)
#Continue to data page #Continue to data page
observeEvent(input$dataSite, { observeEvent(input$dataSite, {
...@@ -186,9 +188,8 @@ server <- function(input, output, session) { ...@@ -186,9 +188,8 @@ server <- function(input, output, session) {
#Title Input #Title Input
output$title <- renderText({ input$title }) output$title <- renderText({ input$title })
#barchart #barchart
output$input_hist_x <- renderUI({ output$input_hist_x <- renderUI({
if (is.null(input$nut)) if (is.null(input$nut))
return(NULL) return(NULL)
...@@ -254,35 +255,43 @@ server <- function(input, output, session) { ...@@ -254,35 +255,43 @@ server <- function(input, output, session) {
#Continue to dashboard page #Continue to dashboard page
observeEvent(input$dashboardSite, { observeEvent(input$dashboardSite, {
updateTabItems(session, "tabs",selected = "dashboard") updateTabItems(session, "tabs",selected = "dashboard")
}) })
#DASHBOARD #ADD BARCHART BUTTON
observeEvent(input$check_hist, {
insertUI(
selector= "#viewpanel", #wo will ichs hinhaben
ui= box( title="Barchart",
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
selectInput("bar_x", "x-axis", choices=colnames(coconut.df)),
selectInput("bar_y", "y-axis", choices=colnames(coconut.df)),
plotOutput("bar", height = 250))
)
print("InsertUI wird aufgerufen.")
#barchart })
output$hist_box <- renderUI({
if(input$check_hist) #DASHBOARD
box( title="Barchart", #BAR VIEW
status= "warning",
solidHeader = TRUE,
collapsible = TRUE,
plotOutput("bar", height = 250))
})
#BAR VIEW output$bar <- renderPlot({
output$bar <- renderPlot({
print("BAR wird aufgerufen.") 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") #Neues Plot
#Neues Plot barplot(data$V1,data$V2,
barplot(data$V1,data$V2, ylab= input$bar_y,
ylab= input$bar_y, xlab=input$bar_x)
xlab=input$bar_x)
})
## ALTES PLOT ## ALTES PLOT
#a=1 #a=1
...@@ -299,7 +308,7 @@ server <- function(input, output, session) { ...@@ -299,7 +308,7 @@ server <- function(input, output, session) {
#g #g
#hist(bluetooth) #hist(bluetooth)
})
#TIMELINE #TIMELINE
...@@ -348,6 +357,9 @@ server <- function(input, output, session) { ...@@ -348,6 +357,9 @@ server <- function(input, output, session) {
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
selectInput("line_x", "x-axis", choices=colnames(coconut.df)),
selectInput("line_y", "y-axis", choices=colnames(coconut.df)),
#add_tooltip(data_tooltip, "hover"),
plotOutput("line", height = 250)) plotOutput("line", height = 250))
}) })
...@@ -358,10 +370,7 @@ server <- function(input, output, session) { ...@@ -358,10 +370,7 @@ server <- function(input, output, session) {
V2=as.numeric(coconut.df[[input$line_y]])), V2=as.numeric(coconut.df[[input$line_y]])),
.Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame") .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
plot(data$V1,data$V2, type="l", ylab=input$line_y, xlab=input$line_x) plot(data$V1,data$V2, type="l", ylab=input$line_y, xlab=input$line_x)
}) })
# Scatterplot # Scatterplot
...@@ -371,6 +380,8 @@ server <- function(input, output, session) { ...@@ -371,6 +380,8 @@ server <- function(input, output, session) {
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
selectInput("scat_x", "x-axis", choices=colnames(coconut.df)),
selectInput("scat_y", "y-axis", choices=colnames(coconut.df)),
plotOutput("scat", height = 250)) plotOutput("scat", height = 250))
}) })
...@@ -381,7 +392,7 @@ server <- function(input, output, session) { ...@@ -381,7 +392,7 @@ server <- function(input, output, session) {
.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("SCAT wird aufgerufen") print("SCAT wird aufgerufen")
plot(data$V1, data$V2, type="p", labx=input$scat_x, laby=input$scat_y ) plot(data$V1,data$V2, type="p", xlab=input$scat_x, ylab=input$scat_y )
}) })
# Boxplot # Boxplot
...@@ -391,6 +402,7 @@ server <- function(input, output, session) { ...@@ -391,6 +402,7 @@ server <- function(input, output, session) {
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
selectInput("box_x", "x-axis", choices=colnames(coconut.df)),
plotOutput("box", height = 250)) plotOutput("box", height = 250))
}) })
...@@ -400,7 +412,7 @@ server <- function(input, output, session) { ...@@ -400,7 +412,7 @@ server <- function(input, output, session) {
data<- structure(list(V1=as.numeric(coconut.df[[input$box_x]])), data<- structure(list(V1=as.numeric(coconut.df[[input$box_x]])),
.Names=c("V1"), row.names=c(NA,6L), class = "data.frame") .Names=c("V1"), row.names=c(NA,6L), class = "data.frame")
boxplot(data$V1, type="box", labx=input$box_x ) boxplot(data$V1, type="box", xlab=input$box_x )
}) })
#MAP #MAP
...@@ -410,6 +422,7 @@ server <- function(input, output, session) { ...@@ -410,6 +422,7 @@ server <- function(input, output, session) {
status= "warning", status= "warning",
solidHeader = TRUE, solidHeader = TRUE,
collapsible = TRUE, collapsible = TRUE,
selectInput("map_data", "data", choices=colnames(coconut.df)),
leafletOutput("map", height = 250)) leafletOutput("map", height = 250))
}) })
...@@ -427,8 +440,12 @@ server <- function(input, output, session) { ...@@ -427,8 +440,12 @@ server <- function(input, output, session) {
# TOOLTIP
data_tooltip <- function(x){
if(is.null(x)) return(NULL)
if(is.null(x$ID)) return(NULL)
paste0(coconut.df[[input$line_x]])
}
#DownloadButton #DownloadButton
#TODO: MAKE IT WORK! #TODO: MAKE IT WORK!
......
...@@ -75,15 +75,14 @@ ui <- dashboardPage( ...@@ -75,15 +75,14 @@ ui <- dashboardPage(
tabsetPanel( tabsetPanel(
tabPanel("Barchart", tabPanel("Barchart",
#Barchart #Barchart
checkboxInput("check_hist", "Barchart", FALSE), actionButton("check_hist", "add Barchart")
selectInput("bar_x", "x-axis", choices=colnames(coconut.df)),
selectInput("bar_y", "y-axis", choices=colnames(coconut.df))
#uiOutput("input_hist_x"), #uiOutput("input_hist_x"),
#uiOutput("input_hist_y") #uiOutput("input_hist_y")
), ),
#TIMELINE #TIMELINE
tabPanel("Timeline", tabPanel("Timeline",
checkboxInput("check_time", "Timeline", FALSE), actionButton("check_time", "add Timeline"),
textOutput("texttimeline") textOutput("texttimeline")
#selectInput("time_data", "data", choices=colnames(coconut.df)) #selectInput("time_data", "data", choices=colnames(coconut.df))
#uiOutput("input_time_x"), #uiOutput("input_time_x"),
...@@ -91,36 +90,34 @@ ui <- dashboardPage( ...@@ -91,36 +90,34 @@ ui <- dashboardPage(
), ),
#Linechart #Linechart
tabPanel("Linechart", tabPanel("Linechart",
checkboxInput("check_line", "Linechart", FALSE), actionButton("check_line", "add Linechart")
selectInput("line_x", "x-axis", choices=colnames(coconut.df)),
selectInput("line_y", "y-axis", choices=colnames(coconut.df))
#uiOutput("input_line_x"), #uiOutput("input_line_x"),
#uiOutput("input_line_y") #uiOutput("input_line_y")
), ),
#Scatterplot #Scatterplot
tabPanel("Scatterplot", tabPanel("Scatterplot",
checkboxInput("check_scat", "Scatterplot", FALSE), actionButton("check_scat", " add Scatterplot")
selectInput("scat_x", "x-axis", choices=colnames(coconut.df)),
selectInput("scat_y", "y-axis", choices=colnames(coconut.df))
), ),
#Boxplot #Boxplot
tabPanel("Boxplot", tabPanel("Boxplot",
checkboxInput("check_box", "Boxplot", FALSE), actionButton("check_box", "add Boxplot")
selectInput("box_x", "x-axis", choices=colnames(coconut.df))#,
#selectInput("box_y", "y-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), actionButton("check_map", "add Map")
selectInput("map_data", "data", choices=colnames(coconut.df))
) )
) )
), ),
mainPanel(column(width = 12, mainPanel(id="viewpanel", column(width = 12,
h2(textOutput("title")), h2(textOutput("title")),
uiOutput("hist_box"), #uiOutput("hist_box"),
uiOutput("time_box"), uiOutput("time_box"),
#timevisOutput("time"), #timevisOutput("time"),
uiOutput("line_box"), uiOutput("line_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