v_line | R Documentation |
Create a Line Chart
v_line(
vc,
mapping = NULL,
data = NULL,
name = NULL,
line = list(style = list(curveType = "linear", lineDash = 0, stroke = NULL)),
point = list(visible = FALSE),
...,
serie_id = NULL,
data_id = NULL
)
vc |
A chart initialized with |
mapping |
Default list of aesthetic mappings to use for chart. |
data |
Default dataset to use for chart. If not already
a |
name |
Name for the serie, only used for single serie (no |
line |
Line's options, such as curve interpolation type, see online documentation |
point |
Options for showing points on lines or not. |
... |
Additional parameters for the serie. |
data_id , serie_id |
ID for the data/serie, can be used to further customize the chart with |
A vchart()
htmlwidget
object.
library(vchartr)
# Basic Line Chart
vchart(eco2mix) %>%
v_line(aes(date, solar))
# Two lines
vchart(tail(eco2mix, 30), aes(date)) %>%
v_line(aes(y = solar)) %>%
v_line(aes(y = wind))
# Line chart with discrete x axis
vchart(data.frame(month = month.abb, value = sample(1:50, 12))) %>%
v_line(aes(month, value))
# Stroke color
vchart(data.frame(month = month.abb, value = sample(1:50, 12))) %>%
v_line(
aes(month, value),
line = list(style = list(stroke = "firebrick"))
)
# Smooth Line Chart
vchart(data.frame(month = month.abb, value = sample(1:50, 12))) %>%
v_line(
aes(month, value),
line = list(style = list(curveType = "monotone"))
)
# Step Line Chart
vchart(data.frame(month = month.abb, value = sample(1:50, 12))) %>%
v_line(
aes(month, value),
line = list(style = list(curveType = "stepAfter"))
)
# Dash array
vchart(data.frame(month = month.abb, value = sample(1:50, 12))) %>%
v_line(
aes(month, value),
line = list(style = list(lineDash = c(10, 10)))
)
# Multiple lines
vchart(eco2mix_long) %>%
v_line(aes(date, production, color = source))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.