Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(shiny)
- library(RMySQL)
- # Define UI for application that draws a histogram
- ui <- fluidPage(
- # Give the page a title
- titlePanel("Channel Plot"),
- # Generate a row with a sidebar
- sidebarLayout(
- # Define the sidebar with one input
- sidebarPanel(
- selectInput("Channel", "Channel Selector:",
- choices=rownames(dataChannel)),
- hr(),
- helpText("Select the channel you want to show.")
- ),
- # Create a spot for the barplot
- mainPanel(
- plotOutput("Channelplot")
- )
- )
- )
- # Define a server for the Shiny app
- server <- function(input, output) {
- mydb = dbConnect(MySQL(), user='pxleai1q_1501057', password='zo4dbCfsqcI7', dbname='pxleai1q_1501057', host='pxl-ea-ict.be')
- dbListFields(mydb, 'ssFinal')
- #rsID = dbSendQuery(mydb, "select id from ssFinal")
- #dataID = fetch(rsID, n=-1)
- rsMAC = dbSendQuery(mydb, "select MAC from ssFinal")
- dataMAC = fetch(rsMAC, n=-1)
- rsRSSI = dbSendQuery(mydb, "select RSSI from ssFinal")
- dataRSSI = fetch(rsRSSI, n=-1)
- rsChannel = dbSendQuery(mydb, "select Channel from ssFinal")
- dataChannel = fetch(rsChannel, n=-1)
- rsInlog = dbSendQuery(mydb, "select Inlog from ssFinal")
- dataInlog = fetch(rsInlog, n=-1)
- rsLastseen = dbSendQuery(mydb, "select Lastseen from ssFinal")
- dataLastseen = fetch(rsLastseen, n=-1)
- dataMAC
- dataRSSI
- dataChannel
- dataInlog
- dataLastseen
- #df <- data.frame(dfMAC = c(dataMAC), dfRSSI = c(dataRSSI), dfInlog = c(dataInlog), dfChannel = c(dataChannel))
- #df
- #
- #MAC <- df$MAC
- #INLOG <- df$Inlog
- #RSSI <- df$RSSI
- #CHANNEL <- df$Channel
- # Fill in the spot we created for a plot
- output$Channelplot <- renderPlot({
- # Render a barplot
- barplot(WorldPhones[,input$Channel]*1000,
- main=input$Channel,
- ylab="Channel",
- xlab="Number of connections")
- })
- }
- # Run the application
- shinyApp(ui = ui, server = server)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement