add_waterfall_bars: Add waterfall style bars to the column chart

Description Usage Arguments Value

View source: R/column_chart_functions.R

Description

Add waterfall style bars to the column chart

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
add_waterfall_bars(
  svg_string,
  df,
  x,
  series,
  bar_width,
  styles = NULL,
  pos_color = "rgb(64,64,64)",
  neg_color = "black",
  add_result_bar = TRUE,
  result_bar_pos = "1",
  positive_prefix = "",
  result_bar_color = NULL,
  result_title = NULL,
  ref_value = 0,
  translate_vec = c(0, 0)
)

Arguments

svg_string

the svg string to br appended, need to be finalized after

df

data to be plotted - data frame in wide format

x

vector to be on x axis

series

character vector of column names representing series to split bars by it

bar_width

the width of plotted bar

styles

vector of styles of the bars

pos_color

color to be associated with positive values (in string format)

neg_color

color to be associated with negative values (in string format)

add_result_bar

boolean flag to add result bar as the last bar or not.

result_bar_pos

flag indicating position of the result bar. 1 - bar offset 1/9 category width right from the last bar. 2 - result bar as completely new bar. If add_result_bar is false, it is ignored.

positive_prefix

how to indicate positive value, ie. "+" or ""(empty string).

result_bar_color

color of result bar. If add_result_bar is false, it is ignored.

result_title

title of result bar to be on x axis. If add_result_bar is false, it is ignored.

ref_value

first bar starts from this value, intended to be used with add_first_bar function.

translate_vec

2 element translation vector. By setting this parameter you can translate bars and legend.

Value

svg string with appended waterfall bars


tidycharts documentation built on Jan. 18, 2022, 5:07 p.m.