Description Usage Arguments Value Examples
Create a tuichart
htmlwidget
1 2 3 4 5 6 7 8 |
type |
Type of chart. |
data |
A |
options |
A |
width |
A numeric input in pixels. |
height |
A numeric input in pixels. |
elementId |
Use an explicit element ID for the widget. |
A tuichart
htmlwidget
object.
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 | library(gapminder)
library(dplyr)
n_countries <- gapminder_unfiltered %>%
filter(year == 2007) %>%
count(continent)
# a barchart
tuichart("column") %>%
add_data(n_countries, aes(x = continent, y = n)) %>%
tui_series(showLabel = TRUE)
# a treemap
tuichart("treemap") %>%
add_data(n_countries, aes(level1 = continent, value = n)) %>%
tui_series(showLabel = TRUE)
# a pie chart
tuichart("pie") %>%
add_data(n_countries, aes(x = continent, y = n)) %>%
tui_series(showLabel = TRUE)
gdp_italy <- gapminder_unfiltered %>%
filter(country == "Italy")
# line chart
tuichart("line") %>%
add_data(gdp_italy, aes(x = year, y = gdpPercap)) %>%
tui_chart(
title = "A chart",
format = "0.00"
) %>%
tui_series(
zoomable = TRUE
) %>%
tui_plot(
hideLine = TRUE
) %>%
tui_xAxis(
tickInterval = "auto",
title = "X axis title"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.