Generate grouped column chart for visualizing up to 3 data series.

column_chart_grouped(
  x,
  foreground,
  background,
  markers = NULL,
  data = NULL,
  series_labels,
  styles = NULL,
  interval = "months"
)

Arguments

x

vector containing labels for x axis or name of column in data with values of x axis labels

foreground

vector or name of column in data representing heights of bars visible in the foreground

background

vector or name of column in data representing heights of bars visible in the background

markers

optional vector representing position of triangles

data

data frame in wide format containing data to be plotted

series_labels

vector of series titles. Consists of 2 or 3 elements

styles

optional dataframe of styles. First column contains styles for foreground series, second for background, third for triangles. dim(styles) must be length(x), length(titles)

interval

intervals on x axis. The width of the bars depends on this parameter

Value

object of class tidychart with a character vector containing SVG elements

Examples

df <- data.frame(x = month.abb[7:12], actual = rnorm(6, mean = 5, sd = 0.3), budget = rnorm(6, mean = 4.5, sd = 0.7), prev_year = rnorm(6, mean = 4)) column_chart_grouped(x = df$x, foreground = df$actual, background = df$budget, markers = df$prev_year, series_labels = c('AC', 'BU', 'PY'))