tuichart: Create a 'tuichart' htmlwidget

Description Usage Arguments Value Examples

View source: R/tuichart.R

Description

Create a tuichart htmlwidget

Usage

1
2
3
4
5
6
7
8
tuichart(
  type = "bar",
  data = NULL,
  options = NULL,
  width = NULL,
  height = NULL,
  elementId = NULL
)

Arguments

type

Type of chart.

data

A list of parameters for the data used in the chart.

options

A list of options for the chart.

width

A numeric input in pixels.

height

A numeric input in pixels.

elementId

Use an explicit element ID for the widget.

Value

A tuichart htmlwidget object.

Examples

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

dreamRs/tuichartr documentation built on Aug. 8, 2020, 9:58 a.m.