Create an Area Chart
v_area.RdCreate an Area Chart
Arguments
- vc
A chart initialized with
vchart().- mapping
Default list of aesthetic mappings to use for chart.
- data
Default dataset to use for chart. If not alreadya
data.frame, it will be coerced to withas.data.frame.- name
Name for the serie, only used for single serie (no
color/fillaesthetic supplied).- stack
Whether to stack the data or not (if
fillaesthetic is provided).- area
Area's options, such as curve interpolation type,seeonline documentation.
- point
Options for showing points on lines or not.
- line
Options for showing 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
v_specs().
Value
Avchart()htmlwidget object.
Examples
library(vchartr)# Basic Area Chartvchart(eco2mix)%>%v_area(aes(date,solar))# Two areasvchart(eco2mix,aes(date))%>%v_area(aes(y=wind))%>%v_area(aes(y=solar))# Line chart with discrete x axisvchart(data.frame(month=month.abb, value=sample(1:50,12)))%>%v_area(aes(month,value))# Fill colorvchart(data.frame(month=month.abb, value=sample(1:50,12)))%>%v_area(aes(month,value), area=list( style=list(fill="firebrick", fill_opacity=0.9)))# Smooth Area Chartvchart(data.frame(month=month.abb, value=sample(1:50,12)))%>%v_area(aes(month,value), area=list( style=list(curveType="monotone")))# Step Area Chartvchart(data.frame(month=month.abb, value=sample(1:50,12)))%>%v_area(aes(month,value), area=list( style=list(curveType="stepAfter")))# Multiple areasvchart(eco2mix_long)%>%v_area(aes(date,production, fill=source))vchart(eco2mix_long)%>%v_area(aes(date,production, fill=source), stack=TRUE, area=list( style=list(fillOpacity=1)))# Range area chartvchart(temperatures,aes(date))%>%v_area(aes(ymin=low, ymax=high))%>%v_line(aes(y=average))within(temperatures,{difference=`2024`-average})%>%vchart(aes(date))%>%v_area(aes(ymin=average, ymax=`2024`, difference=difference), area=list( style=list( fill=JS("data => { return data.difference > 0 ? '#F68180' : '#2F64FF' ; }"), fillOpacity=1)))