mtcars2 <- mtcars |>
head() |>
tibble::rownames_to_column("model")
e1 <- mtcars2 |>
e_charts(model) |>
e_bar(
carb,
universalTransition = TRUE,
animationDurationUpdate = 1000L
)
e2 <- mtcars2 |>
e_charts(model) |>
e_pie(
carb,
universalTransition = TRUE,
animationDurationUpdate = 1000L
)
cb <- "() => {
let x = 0;
setInterval(() => {
x++
chart.setOption(opts[x % 2], true);
}, 3000);
}"
e_morph(e1, e2, callback = cb)
Run the code above in your browser using DataLab