Generates basic horizontal barchart with index on a given value. If more than one series is supplied, stacked barchart is generated.

bar_chart_reference(
data,
cat,
series,
ref_val,
series_labels = series,
styles = NULL,
ref_label = ref_val
)

## Arguments

data data frame containing data to be plotted vector containing category names of values vector containing names of columns in data with values to plot numeric value of the index vector containing names of series to be shown on the plot optional vector with styles of bars string defining a text that should be displayed in the referencing line. Set by default to index_val.

## Value

object of class tidychart with a character vector containing SVG elements

## Examples


#prepare the data frame
data <- data.frame(
city = c("Berlin", "Munich", "Cologne", "London", "Vienna", "Paris", "Zurich"),
Products = c(538, 250, 75, 301, 227, 100, 40),
Services = c(621, 545, 302, 44, 39, 20, 34)
)
#create svg string
barchart_ref <- bar_chart_reference(data, data\$city, c("Products"), 100, c("Products"))

#show the plot
barchart_ref