Animate plots using echarts4r when quarto slides are on-screen

Viewed 73

I am making a Revealjs presentation using Quarto in R Studio. I am using echarts4r to make my plots. echarts4r comes with default animations. When I render the presentation the default animation has already loaded for all the slides. I want to run the default echarts4r animations when the slide is active (i.e. when the slide is in view) and reset when someother slide is active. Could someone help me with this?

Here is the code to the .qmd file.

---
title: "A Title"
subtitle: "A Subtitle"
author: "First Last"
institute: "Some Institute"
date: today
self-contained: true
format: revealjs
---


## Introduction

Hello There!


## Pie Chart

```{r}
library(tidyverse)
library(echarts4r)

data <- tibble(name = c("A", "B", "C", "D", "E", "F", "G"),
               number = c(9.7, 2.1, 2.1, 1.9, 1.9, 1.9, 80.4))

data %>% 
  e_charts(name) %>% 
  e_pie(number, radius = c("50%", "70%")) %>% 
  e_legend(orient = "vertical", right = "5", top = "65%")
```
0 Answers
Related