Loading dashboard/server.R +30 −9 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ library(Cairo) #creating the pdf for download library(grDevices) # also necessary for the download library(anytime) # for correctly parsing unixtimestamps into readable date and time formats library(shinydashboard) # creating the structure / dashboard structure-items library(gridExtra) server <- function(input, output, session) { set.seed(122) Loading Loading @@ -177,6 +179,7 @@ server <- function(input, output, session) { plotname <<- paste("plot", plotCounter, sep="") xplotname<<- paste("x",plotname,sep="") yplotname<<-paste("y",plotname, sep="") array_plots <<- list() #BARCHART box insert observeEvent(input$check_hist, { Loading @@ -186,6 +189,8 @@ server <- function(input, output, session) { plotCounter<<-plotCounter+1 xplotname<<- paste("x",plotname,sep="") yplotname<<-paste("y",plotname, sep="") array_plots <<- c(array_plots, plotname) #Inserting box & Chart insertUI( Loading @@ -197,16 +202,18 @@ server <- function(input, output, session) { collapsible = TRUE, selectInput(xplotname, "x-axis", choices=colnames(coconut.df)), selectInput(yplotname, "y-axis", choices=colnames(coconut.df)), plotOutput(plotname, height = 400)) ) local({ # data handling output[[plotname]] <- renderPlot({ #assign(paste("data", plotCounter,sep="_")) data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]]), V2=as.numeric(coconut.df[[input[[yplotname]]]])), .Names=c("V1","V2"), row.names=c(NA,10L), class = "data.frame") # New Bar-Plot barplot(data$V2,data$V1, array_plots <<-arrangeGrob(array_plots, barplot(data$V2,data$V1, ylab=input[[yplotname]], xlab=input[[xplotname]], names.arg = data$V1 Loading @@ -214,9 +221,10 @@ server <- function(input, output, session) { #, #las=2 #axis.lty=1 ) )) }) }) #Local end }) #BARCHART text Loading Loading @@ -249,7 +257,7 @@ server <- function(input, output, session) { end = parsedEndtimes ) #New Timeline timevis(data) array_plots <<-arrangeGrob(array_plots,timevis(data)) }) }) Loading Loading @@ -481,17 +489,30 @@ server <- function(input, output, session) { #TODO: DownloadButton output$down.pdf <- downloadHandler( print("DOWNLOAD"), #print(V1) filename = "download.pdf", content = function(file) { CairoPDF(file = file, width=12, height=8) #boxplot(data$V1, type="box", xlab=input$box_x) #m #leafletOutput("map", height = 250) output$box data<- structure(list(V1=as.numeric(coconut.df[[input$scat_x]]), V2=as.numeric(coconut.df[[input$scat_y]])), .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame") plot(data$V1,data$V2, type="p", xlab=input$scat_x, ylab=input$scat_y ) # output[[plotname]] <- renderPlot({ # # #handling data # data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]])), # .Names=c("V1"), row.names=c(NA,10L), class = "data.frame") # print(data) # #new Boxplot # boxplot(data$V1, type="box", xlab=input[[xplotname]]) # # }) data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]])), .Names=c("V1"), row.names=c(NA,10L), class = "data.frame") boxplot(data$V1, type="box", xlab=input[[xplotname]]) #print(array_plots) dev.off() }) } ) } dashboard/ui.R +2 −2 Original line number Diff line number Diff line Loading @@ -139,9 +139,9 @@ ui <- dashboardPage( uiOutput("scat_box"), uiOutput("box_box"), uiOutput("map_box"), uiOutput("pdfview")#, uiOutput("pdfview"), # downloadButton("down.pdf","Download") downloadButton("down.pdf","Download") ) ) Loading import/Packages.R +2 −0 Original line number Diff line number Diff line Loading @@ -8,3 +8,5 @@ install.packages("timevis") install.packages("Cairo") install.packages("grDevices") install.packages("gridExtra") Loading
dashboard/server.R +30 −9 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ library(Cairo) #creating the pdf for download library(grDevices) # also necessary for the download library(anytime) # for correctly parsing unixtimestamps into readable date and time formats library(shinydashboard) # creating the structure / dashboard structure-items library(gridExtra) server <- function(input, output, session) { set.seed(122) Loading Loading @@ -177,6 +179,7 @@ server <- function(input, output, session) { plotname <<- paste("plot", plotCounter, sep="") xplotname<<- paste("x",plotname,sep="") yplotname<<-paste("y",plotname, sep="") array_plots <<- list() #BARCHART box insert observeEvent(input$check_hist, { Loading @@ -186,6 +189,8 @@ server <- function(input, output, session) { plotCounter<<-plotCounter+1 xplotname<<- paste("x",plotname,sep="") yplotname<<-paste("y",plotname, sep="") array_plots <<- c(array_plots, plotname) #Inserting box & Chart insertUI( Loading @@ -197,16 +202,18 @@ server <- function(input, output, session) { collapsible = TRUE, selectInput(xplotname, "x-axis", choices=colnames(coconut.df)), selectInput(yplotname, "y-axis", choices=colnames(coconut.df)), plotOutput(plotname, height = 400)) ) local({ # data handling output[[plotname]] <- renderPlot({ #assign(paste("data", plotCounter,sep="_")) data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]]), V2=as.numeric(coconut.df[[input[[yplotname]]]])), .Names=c("V1","V2"), row.names=c(NA,10L), class = "data.frame") # New Bar-Plot barplot(data$V2,data$V1, array_plots <<-arrangeGrob(array_plots, barplot(data$V2,data$V1, ylab=input[[yplotname]], xlab=input[[xplotname]], names.arg = data$V1 Loading @@ -214,9 +221,10 @@ server <- function(input, output, session) { #, #las=2 #axis.lty=1 ) )) }) }) #Local end }) #BARCHART text Loading Loading @@ -249,7 +257,7 @@ server <- function(input, output, session) { end = parsedEndtimes ) #New Timeline timevis(data) array_plots <<-arrangeGrob(array_plots,timevis(data)) }) }) Loading Loading @@ -481,17 +489,30 @@ server <- function(input, output, session) { #TODO: DownloadButton output$down.pdf <- downloadHandler( print("DOWNLOAD"), #print(V1) filename = "download.pdf", content = function(file) { CairoPDF(file = file, width=12, height=8) #boxplot(data$V1, type="box", xlab=input$box_x) #m #leafletOutput("map", height = 250) output$box data<- structure(list(V1=as.numeric(coconut.df[[input$scat_x]]), V2=as.numeric(coconut.df[[input$scat_y]])), .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame") plot(data$V1,data$V2, type="p", xlab=input$scat_x, ylab=input$scat_y ) # output[[plotname]] <- renderPlot({ # # #handling data # data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]])), # .Names=c("V1"), row.names=c(NA,10L), class = "data.frame") # print(data) # #new Boxplot # boxplot(data$V1, type="box", xlab=input[[xplotname]]) # # }) data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]])), .Names=c("V1"), row.names=c(NA,10L), class = "data.frame") boxplot(data$V1, type="box", xlab=input[[xplotname]]) #print(array_plots) dev.off() }) } ) }
dashboard/ui.R +2 −2 Original line number Diff line number Diff line Loading @@ -139,9 +139,9 @@ ui <- dashboardPage( uiOutput("scat_box"), uiOutput("box_box"), uiOutput("map_box"), uiOutput("pdfview")#, uiOutput("pdfview"), # downloadButton("down.pdf","Download") downloadButton("down.pdf","Download") ) ) Loading
import/Packages.R +2 −0 Original line number Diff line number Diff line Loading @@ -8,3 +8,5 @@ install.packages("timevis") install.packages("Cairo") install.packages("grDevices") install.packages("gridExtra")