knitr::opts_chunk$set(fig.width = 9, fig.height = 3)

Chart Types

Bar

library(dplyr)
library(rfrappe)

data <- list(
  labels = c("12am-3am", "3am-6pm", "6am-9am", "9am-12am", "12pm-3pm", 
             "3pm-6pm", "6pm-9pm", "9am-12am"),
  datasets = list(
    list(
      title = "Some Data",
      color = "light-blue",
      values = c(25, 40, 30, 35, 8, 52, 17, -4)
    ),
    list(
      title = "Another Set",
      color = "violet",
      values = c(25, 50, -10, 15, 18, 32, 27, 14)
    )
  )
)

rfrappe(list(
  data = data,
  type = "bar",
  # some optional arguments
  height = 250,
  title = "My Awesome Bar Chart"
))

Line

rfrappe(list(
  data = data,
  type = "line",
  # optional arguments
  title = "My Awesome Line Chart",
  show_dots = 0, # 0 for not show, or 1 for show; default 0
  region_fill = 1, # fill area under the line; default 0
  heatline = 1 # show a value-wise line gradient; default 0
))
rfrappe(list(
  title = "My Awesome Pie Chart",
  data = data,
  type = "pie"
))

Scatter

rfrappe(list(
  title = "My Awesome Scatter Chart",
  data = data,
  type = "scatter"
))

Percentage

rfrappe(list(
  title = "My Awesome Percentage Chart",
  data = data,
  type = "percentage"
))

Heatmap

heatmap_data <- rpois(365, 3) %>% as.list()
time_stamp <- Sys.time() %>% as.numeric() %>% round(0)
# chnage time to midnight of current day
time_stamp <- time_stamp - (time_stamp %% 86400)
# 1 year of days
time_stamps <- seq(from = time_stamp, by = -86400, length.out = 365)
names(heatmap_data) <- time_stamps


rfrappe(list(
  data = heatmap_data,
  type = "heatmap",
  # optional arguments
  height = 115,
  discrete_domains = 1
))


merlinoa/rfrappe documentation built on Oct. 19, 2020, 4:46 p.m.