Created
October 4, 2015 06:56
-
-
Save haozhu233/e107c761b62a14e04735 to your computer and use it in GitHub Desktop.
a question on so
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
shinyServer( | |
function(input, output) { | |
x <- data.frame(PRODUCT=factor(c("ALPHA", "ALPHA","BRAVO","ALPHA","ALPHA")), | |
YYYYMM= factor(c("2/1/2015","3/1/2015","4/1/2015","5/1/2015","6/1/2015")), | |
COUNT=c(44,22,37,76,97)) | |
## select only rows where PRODUCT = input$product | |
x1 <- reactive({ | |
x[ ( x$PRODUCT == input$product | input$product == "all") , ] | |
}) | |
output$pr <- renderText(input$product) | |
output$chart <- renderPlot({ | |
#hist(x$COUNT) | |
hist(x1()$COUNT) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(rCharts) | |
shinyUI(fluidPage( | |
titlePanel("Count Report "), | |
h4("This application shows product data"), | |
sidebarLayout( | |
sidebarPanel( | |
selectizeInput("product","Product:",c("ALPHA","BRAVO","all"), selected="all") | |
), | |
mainPanel( | |
h4("Chart "), | |
h4(textOutput("pr")), | |
plotOutput("chart") | |
) | |
) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment