line_chart_markers: Generates line plot with markers on every value.

Description Usage Arguments Value Examples

View source: R/line_chart_markers.R

Description

Generates line plot with markers on every value.

Usage

1
2
3
4
5
6
7
8
line_chart_markers(
  data,
  x,
  series,
  series_labels,
  interval = "months",
  styles = NULL
)

Arguments

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

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.

Value

object of class tidychart with a character vector containing SVG elements

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#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 <- line_chart_markers(data, data$time, c("PL", "AC"), c("PL", "AC"),"months", styles)

#show the plot
line_chart

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