line_chart_normalized: Generates normalized areas (stacked lines) plot. If more than...

Description Usage Arguments Value Examples

View source: R/line_chart_normalized.R

Description

Generates normalized areas (stacked lines) plot. If more than one series is supplied, stacked areas plot is generated.

Usage

1
2
3
4
5
6
7
8
line_chart_normalized(
  data,
  x,
  series,
  series_labels,
  show_labels,
  interval = "months"
)

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

show_labels

vector of the same length as cat containing NA or not NA values defining which categories should have labels of values displayed

interval

intervals on x axis. The width of the bars depends on this parameter

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 data frames
data <- data.frame(
weeks =    c(28,   29, 30,  31,  32,  33,  34,  35,  36, 37),
Services = c(130,150, 182, 170, 170, 140, 130, 130, 135, 140),
Software = c(100, 88, 83,   90, 92,   95, 129, 130, 130, 135),
Products = c(20,  35, 36,    40, 22,  25, 24,   19,  36,  40)
)

#defining the rest of the arguments
series <- c("Software", "Services", "Products")
labels <- c(NA, 1, NA, 1, NA, NA, 1, NA, 1, NA)

#generating the SVG string
line_chart_normalized <- line_chart_normalized(data, data$weeks, series, series, labels, "weeks")

#show the plot
line_chart_normalized

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