e_morph: Morphing

e_morphR Documentation

Morphing

Description

__This is experimental__

Usage

e_morph(e, ..., callback, default = 1L)

Arguments

e, ...

Graphs (from 'e_graph').

callback

JavaScript callback function as a character string (vector of length 1). This function has access to the 'chart' object, as well as 'opts' an array containing the options of the charts passed to 'e' and '...'.

default

Default chart to show.

Details

Morph between graphs.

Examples

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)


echarts4r documentation built on July 9, 2023, 7:26 p.m.