Description Usage Arguments Examples
series.
1 |
ec |
An |
... |
Additional arguments for the series (https://echarts.apache.org/zh/option.html#series). |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | library(dplyr)
library(echarter)
weekDays <- c('Mon','Tues','Wed','Thurs','Fri','Sat','Sun')
echart() %>%
ec_xAxis(type = 'category', data = weekDays) %>%
ec_yAxis(type = 'value') %>%
ec_series(
type = 'line',
name = 'Apple',
data = as.integer(runif(7, 20,100)))
echart() %>%
ec_xAxis(type = 'category', data = weekDays) %>%
ec_yAxis(type = 'value') %>%
ec_add_series(
type = 'line',
name = 'Apple',
data = as.integer(runif(7, 20,100)))
dat <- data.frame(
saleNum = round(runif(21, 20, 100), 0),
fruit = c(rep("Apple", 7), rep("Pear", 7), rep("Banana", 7)),
weekDay = c(rep(weekDays,3)),
price = round(runif(21, 10, 20), 0),
stringsAsFactors = FALSE)
dat_sp <- dat %>%
select(fruit, weekDay, saleNum) %>%
tidyr::spread(fruit, saleNum) %>%
arrange(match(weekDay, weekDays))
echart() %>%
ec_xAxis(type = 'category', data = weekDays) %>%
ec_yAxis(type = 'value') %>%
ec_dataset(data = dat_sp) %>%
ec_series(
name = "Apple",
datasetIndex = 0,
type = 'line', encode = list(y = "Apple")) %>%
ec_series(
name = "Banana",
datasetIndex = 0,
type = 'line', encode = list(y = 2, tooltip = c(0, 3)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.