Echarts4r

Project
Package
R
Interactive
DataViz
Author

David Munoz Tord

Published

April 12, 2022

Easy and beautiful interactive dataviz with Echarts4r!

This R package is a wrapper of the ECharts library. It provides a set of functions to generate interactive charts in R.

library(dplyr)
library(echarts4r)
library(lubridate)

# Plot 1
mtcars |>
  e_charts(cyl) |> 
  e_boxplot(disp, colorBy="data",) |>
  e_boxplot(hp, colorBy="data",) |>
  e_boxplot(mpg, colorBy="data",) |>
  e_tooltip(trigger = "axis") |>
  e_title("Descriptive Stats on mtcars Data") |>
  e_toolbox_feature(feature = "saveAsImage")  # add the download button!
# Plot 2
lakers |>           
  mutate(date = lubridate::ymd(date)) |>
  mutate(points = points+runif(n=34624, min=-0.5, max=0.5) ) |>
  group_by(date) |>
  summarise(points2 = sum(points),
            min= points2 - (50 +min(points)),
            max=points2 + (50+max(points)) ) |> 
  e_charts(date) |>
  e_line(points2) |>
  e_band2(min, max, color = "lemonchiffon") |>
  e_tooltip(trigger = "axis") |>
  e_title("Lakers Timeseries Data") |>
  e_toolbox_feature(feature = "saveAsImage")  # add the download button!
# Plot 3
starwars |>
  e_charts(mass) |>
  e_scatter(height, bind = name, symbol_size = 5, legend =F) |>
  e_datazoom() |>
  e_tooltip(
    formatter = htmlwidgets::JS("
      function(params){
        return('<strong>' + params.name + 
                '</strong><br />mass: ' + params.value[0] + 
                '<br />height: ' + params.value[1]) 
                }
    ")) |> # little JS formatter to make it pretty
  e_title("Starwars Outlier Data") |>
  e_toolbox_feature(feature = "saveAsImage")  # add the download button!





Full Screen


Description

Highlights of this package:

- Provide functions to generate interactive charts in R.
- The package is built on top of the ECharts library, which is a powerful library for data visualization.
- The package provides a set of functions that can be used to generate charts with ECharts.
- The package is still under development. More features will be added in the future.
- The package is open source.



Features of the package:

  • Provides more than 20 chart types available out of the box, along with a dozen components, and each of them can be arbitrarily combined to use.
  • Has a powerful rendering engine that allows you to easily switch between Canvas and SVG rendering. Progressive rendering and stream loading make it possible to render 10 million data in realtime.
  • Offers professional data analysis through datasets, which support data transforms like filtering, clustering, and regression to help analyze multi-dimensional analysis of the same data.
  • Has an elegant visual design that follows visualization principles and supports responsive design. Flexible configurations make it easy to customize.
  • Has a healthy community that ensures the healthy development of the project and contributes a wealth of third-party extensions.
  • Is accessibility-friendly with automatically generated chart descriptions and decal patterns that help users with disabilities understand the content and the stories behind the charts.


You can check the project on Github.