Generates grouped horizontal barchart with scenario triangles.

bar_chart_grouped(
  data,
  cat,
  foreground,
  background,
  markers = NULL,
  series_labels,
  styles = NULL
)

Arguments

data

data frame in wide format containing data to be plotted

cat

vector cointaining category names of values

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

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)

Value

object of class tidychart with a character vector containing SVG elements

Examples

#preparing data frames data <- data.frame( city = c("Berlin", "Paris", "London", "Munich", "Vienna"), AC = c(592, 1166, 618, 795, 538), PL = c(570, 950, 800, 780, 460), triangles = c(545, 800, 900, 600, 538) #AC toten bardziej na wierzchu ) #preparing the styles data frame df_styles <- data.frame( AC = c("actual","actual","actual","actual","actual"), PL = c("plan","plan","plan","plan","plan"), triangles = c("previous", "previous","previous","previous","previous")) #creating the svg string barchart_grouped <- bar_chart_grouped(data, data$city, "AC", "PL","triangles", c("triangles", "AC", "PL"), df_styles) #showing the plot barchart_grouped