Goal: Learn about data visualization and familiarize yourself with some of the basic functions of the {echarts4r}.
{echarts4r} is back! And with version 4.5 the new features from version 5 of echarts.js are available now. Moreover, the morphing capabilities of echart.js have been ported to echarts4r as we will show in this post.
You can morph between plot like this:
library(echarts4r)
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)
## Warning in e_morph(e1, e2, callback = cb): This is experimental