Created
February 23, 2018 09:08
-
-
Save cecilialee/cb019abf17454af27113bebc026637cf to your computer and use it in GitHub Desktop.
Create a division in ui.R showing one dc chart in dcr. #r #shiny #dcr
This file contains hidden or 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(dcr) | |
| ui = fluidPage( | |
| chartOutput("plot"), | |
| fluidRow(column(6, dc_ui("chart1", text = "cyl", | |
| show_filter = TRUE, | |
| reset_text = TRUE)), | |
| column(6, dc_ui("chart2", text = "gear by carb", | |
| show_filter = TRUE, | |
| reset_text = TRUE))) | |
| ) | |
| server = function(input, output) { | |
| output$plot <- renderChart({ | |
| dcr <- dcr(mtcars) | |
| chart1 <- dcrchart(type = "pieChart", id = "chart1", dimension = "cyl", | |
| reduce = reduceCount(), width = 400, height = 250) | |
| chart2 <- dcrchart(type = "lineChart", id = "chart2", dimension = "gear", | |
| reduce = reduceMean("carb"), width = 400, height = 250) | |
| dcr + chart1 + chart2 | |
| }) | |
| } | |
| shinyApp(ui, server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment