Method to add data is specific to chart's type,
normally add_data
should be enough.
add_data(tui, data, mapping) add_default_data(tui, data, mapping) add_pie_data(tui, data, mapping) add_line_data(tui, data, mapping) add_scatter_data(tui, data, mapping) add_heat_data(tui, data, mapping) add_tree_data(tui, data, mapping) add_boxplot_data(tui, data, mapping) add_map_data(tui, data, mapping)
tui | A |
---|---|
data | A |
mapping | Default list of aesthetic mappings to use for chart. |
A tuichart
htmlwidget
object.
Aesthetics vary according to the type of graph:
bar, column, line, area, radial, boxplot : x, y, and group (optional).
pie : x, y.
heatmap : x, y, value.
treemap : leval1, (level2, level3, ...), value
scatter, bubble : x, y, group (optional), label (optional), size (bubble).
# line chart sinus <- data.frame( x = seq_len(20), y = sin(seq(-pi, pi, length.out = 20)) ) tuichart("line") %>% add_data(sinus, aes(x, y)) # bar chart tuichart("bar") %>% add_data(table(cyl = mtcars$cyl), aes(cyl, Freq)) #♦ with grouping variable tuichart("bar") %>% add_data(table(cyl = mtcars$cyl, am = mtcars$am), aes(cyl, Freq, group = am)) # or pie chart tuichart("pie") %>% add_data(table(cyl = mtcars$cyl), aes(cyl, Freq)) # treemap has different aesthetics tuichart("treemap") %>% add_data(table(cyl = mtcars$cyl), aes(level1 = cyl, value = Freq)) # scatter plot tuichart("scatter") %>% add_data(iris, aes(Sepal.Length, Sepal.Width, group = Species))