vchart | R Documentation |
VChart is a charting component library, see more about it here : https://www.visactor.io/vchart.
vchart(
data = NULL,
mapping = NULL,
...,
width = NULL,
height = NULL,
elementId = NULL
)
data |
Can be a |
mapping |
Default list of aesthetic mappings to use for chart, only used if |
... |
Additional parameters. |
width |
Fixed width for widget (in css units). The default is
|
height |
Fixed height for widget (in css units). The default is
|
elementId |
Use an explicit element ID for the widget (rather than an automatically generated one). Useful if you have other JavaScript that needs to explicitly discover and interact with a specific widget instance. |
A vchart()
htmlwidget
object.
This function allow you to use JavaScript function VChart
directly,
see https://www.visactor.io/vchart/option/ for how to specify options.
library(vchartr)
# Use JS syntax to construct chart
vchart(
type = "line",
data = list(
list(
values = list(
list(month = "January", value = 4.3),
list(month = "February", value = 4.6),
list(month = "March", value = 7.4),
list(month = "April", value = 10.7),
list(month = "May", value = 14.3),
list(month = "June", value = 17.7),
list(month = "July", value = 19.8),
list(month = "August", value = 19.4),
list(month = "September", value = 16.4),
list(month = "October", value = 12.6),
list(month = "November", value = 7.9),
list(month = "December", value = 4.8)
)
)
),
xField = "month",
yField = "value",
crosshair = list(
xField = list(visible = TRUE)
)
)
# or use R API
vchart(meteo_paris) %>%
v_line(aes(month, temperature_avg)) %>%
v_specs(
crosshair = list(
xField = list(visible = TRUE)
)
)
# or
vchart(meteo_paris, aes(month, temperature_avg)) %>%
v_line() %>%
v_specs(
crosshair = list(
xField = list(visible = TRUE)
)
)
# or
vchart() %>%
v_line(aes(month, temperature_avg), data = meteo_paris) %>%
v_specs(
crosshair = list(
xField = list(visible = TRUE)
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.