Description Usage Arguments Value Examples
View source: R/bar_chart_grouped.R
Generates grouped horizontal barchart with scenario triangles.
1 2 3 4 5 6 7 8 9 | bar_chart_grouped(
data,
cat,
foreground,
background,
markers = NULL,
series_labels,
styles = NULL
)
|
data |
data frame in wide format containing data to be plotted |
cat |
vector containing 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) |
object of class tidychart with a character vector containing SVG elements
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.