scale-date | R Documentation |
Axis scale for date/time data
v_scale_x_date(
vc,
name = NULL,
date_breaks = NULL,
date_labels = NULL,
date_labels_tooltip = date_labels,
min = NULL,
max = NULL,
...,
position = "bottom"
)
v_scale_y_date(
vc,
name = NULL,
date_breaks = NULL,
date_labels = NULL,
date_labels_tooltip = date_labels,
min = NULL,
max = NULL,
...,
position = "left"
)
v_scale_x_datetime(
vc,
name = NULL,
date_breaks = NULL,
date_labels = NULL,
date_labels_tooltip = date_labels,
tz = NULL,
min = NULL,
max = NULL,
...,
position = "bottom"
)
v_scale_y_datetime(
vc,
name = NULL,
date_breaks = NULL,
date_labels = NULL,
date_labels_tooltip = date_labels,
tz = NULL,
min = NULL,
max = NULL,
...,
position = "left"
)
vc |
An htmlwidget created with |
name |
Title for the axis. |
date_breaks |
One of:
|
date_labels |
The format to be applied on Date/POSIXct in the labels, see |
date_labels_tooltip |
The format to be applied on Date/POSIXct in the tooltip, see |
min |
Minimum value on the axis. |
max |
Maximum value on the axis. |
... |
Additional parameters for the axis. |
position |
Position of the axis. |
tz |
The timezone. |
A vchart()
htmlwidget
object.
library(vchartr)
# Add a title to the axis
vchart(eco2mix) %>%
v_line(aes(date, solar)) %>%
v_scale_x_date(name = "Date")
# Specify number of labels
vchart(eco2mix) %>%
v_line(aes(date, solar)) %>%
v_scale_x_date(date_breaks = 5)
# Specify intervals between labels
vchart(eco2mix) %>%
v_line(aes(date, solar)) %>%
v_scale_x_date(date_breaks = "2 years")
# Format labels
vchart(eco2mix) %>%
v_line(aes(date, solar)) %>%
v_scale_x_date(date_labels = "MM-YYYY")
# Other format for labels
vchart(eco2mix) %>%
v_line(aes(date, solar)) %>%
v_scale_x_date(date_labels = "MMM YYYY")
# Format labels with locale
vchart(eco2mix) %>%
v_line(aes(date, solar)) %>%
v_scale_x_date(
date_labels = format_date_dayjs("MMMM YY", locale = "fr")
)
# Different formats in labels and tootlip
vchart(eco2mix) %>%
v_line(aes(date, solar)) %>%
v_scale_x_date(
date_labels = "YYYY-MM",
date_labels_tooltip = "MMMM YYYY"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.