ec.clmn: Data column

Description Usage Arguments Details Value Examples

Description

Helper function to address data column(s) by index or name

Usage

1

Arguments

col

A column index(number), column name(string) or a sprintf format string.

...

When col is sprintf, comma separated column indexes or names, but not both. This allows formatting of multiple columns, as for a tooltip.

scale

A multiplier number for column values. Only when col is a single column index or name, ignored otherwise.

Details

Column indexes are counted in R and start at 1.
col as sprintf has the same placeholder %@ for both column indexes or column names.
col as sprintf can contain double quotes, but not single or backquotes.
Useful for attributes like formatter, color, symbolSize.

Value

A JavaScript code string (usually a function) marked as executable, see JS.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
tmp <- data.frame(Species = as.vector(unique(iris$Species)),
                  emoji = c('\U0001F33B','\U0001F335','\U0001F33A'))
df <- iris %>% dplyr::inner_join(tmp)   # add 6th column 'emoji'
p <- df %>% dplyr::group_by(Species) %>% ec.init()
p$x$opts$series <- list(list(
  type='scatter', label=list(show=TRUE, formatter = ec.clmn(6))  # 6th column
))
p$x$opts$tooltip <- list(formatter=
   ec.clmn('species <b>%@</b><br>s.len <b>%@</b><br>s.wid <b>%@</b>', 5,1,2))
p

echarty documentation built on Oct. 24, 2021, 9:06 a.m.

Related to ec.clmn in echarty...