Skip to content

Instantly share code, notes, and snippets.

@cecilialee
Created February 23, 2018 09:08
Show Gist options
  • Select an option

  • Save cecilialee/cb019abf17454af27113bebc026637cf to your computer and use it in GitHub Desktop.

Select an option

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
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