add_bars: add bars to svg string

Description Usage Arguments Value

View source: R/column_chart_functions.R

Description

add bars to svg string

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
add_bars(
  svg_string,
  df,
  x,
  series,
  bar_width,
  styles = NULL,
  x_offset = 0,
  translate = c(0, 0),
  add_x_axis = TRUE,
  color = NULL,
  add_legend = FALSE,
  legend_position = "left_top",
  max_val = NULL
)

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

x_offset

how much bars should be offset to the right (negative value means offsetting to the left)

translate

vector of translation of the bars from the origin

add_x_axis

boolean flag, if true automatically adds x axis with label

color

optional custom color of the bars series, in svg string format, ie.: "rgb(223,12,121)" or "black"

add_legend

boolean flag if legend should be added

legend_position

string with legend position

max_val

maximal value that bars will be scaled to

Value

svg string with added bars


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