R/line_chart_markers.R
line_chart_markers_reference.Rd
Generates line plot with markers on every value with index on a given value.
line_chart_markers_reference( data, x, series, series_labels, ref_val, ref_label = ref_val, interval = "months", styles = NULL )
data | data frame containing data to be plotted |
---|---|
x | vector containing time intervals of the values |
series | vector containing names of columns in data with values to plot |
series_labels | vector containing names of series to be shown on the plot |
ref_val | numeric value of the index |
ref_label | string defining a text that should be displayed in the referencing line. Set by default to index_val. |
interval | intervals on x axis. The width of the bars depends on this parameter |
styles | optional data frame with style names. Styles of the markers will be plotted accordingly. |
object of class tidychart with a character vector containing SVG elements
#preparing a data frame data <- data.frame( time = c("Jan", "Feb", "Mar", "Apr", "May", "Jun"), PL = (c(51, 42, 50, 58, 78, 79) - 30), AC = (c(62, 70, 67, 77, 63, 62) - 30) ) #preparing the styles data frame styles <- data.frame( PL = c("plan", "plan", "plan", "plan", "plan", "plan"), AC = c("actual", "actual", "actual", "forecast", "forecast", "forecast") ) #generating svg string line_chart_ref <- line_chart_markers_reference( data = data, x = data$time, series = c("PL", "AC"), series_labels = c("PL", "AC"), ref_val = 42, ref_label = "index", styles=styles) #show the plot line_chart_ref