ec.upd {echarty} | R Documentation |
Update option lists
Description
Chain commands after ec.init to add or update chart items
Usage
ec.upd(wt, ...)
Arguments
wt |
An echarty widget |
... |
R commands to add/update chart option lists |
Details
ec.upd makes changes to a chart already set by ec.init.
It should be always piped(chained) after ec.init.
All numerical indexes for series,visualMap,etc. are JS-counted and start at 0.
Examples
library(dplyr)
df <- data.frame(x= 1:30, y= runif(30, 5, 10), cat= sample(LETTERS[1:3],size=30,replace=TRUE)) |>
mutate(lwr= y-runif(30, 1, 3), upr= y+runif(30, 2, 4))
band.df <- df |> group_by(cat) |> group_split()
df |> group_by(cat) |>
ec.init(load='custom', ctype='line',
xAxis=list(data=c(0,unique(df$x)), boundaryGap=FALSE) ) |>
ec.upd({
for(ii in 1:length(band.df)) # add bands to their respective groups
series <- append(series,
ecr.band(band.df[[ii]], 'lwr', 'upr', type='stack', smooth=FALSE,
name= unique(band.df[[ii]]$cat), areaStyle= list(color=c('blue','green','yellow')[ii])) )
})
[Package echarty version 1.6.4 Index]