Description Usage Arguments Examples
Output and render functions for using tuichart within Shiny applications and interactive Rmd documents.
1 2 3 | tuichartOutput(outputId, width = "100%", height = "400px")
renderTuichart(expr, env = parent.frame(), quoted = FALSE)
|
outputId |
output variable to read from |
width, height |
Must be a valid CSS unit (like |
expr |
An expression that generates a tuichart |
env |
The environment in which to evaluate |
quoted |
Is |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | if (interactive()) {
library(shiny)
library(dplyr)
library(ggplot2)
library(tuichartr)
ui <- fluidPage(
tags$h2("Include tuichart in Shiny"),
fluidRow(
column(
width = 3,
checkboxGroupInput(
inputId = "year",
label = "Year:",
choices = c(1999, 2008),
selected = c(1999, 2008)
)
),
column(
width = 9,
tuichartOutput(outputId = "my_chart")
)
)
)
server <- function(input, output, session) {
output$my_chart <- renderTuichart({
data <- filter(mpg, year %in% input$year) %>%
count(manufacturer)
tuichart("bar") %>%
add_data(data, aes(x = manufacturer, y = n)) %>%
tui_chart(title = "My cool chart") %>%
tui_xAxis(title = "Count") %>%
tui_legend(visible = FALSE) %>%
tui_series(showLabel = TRUE)
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.