Skip to content

meekalpha/echartr

Repository files navigation

echartr

echartr website

The R package echartr provides an interface to the Echarts JavaScript library for creating interactive charts.

echartr aims to match the Echarts Javascript API as closely as possible so that you can refer directly to the official Echarts documentation.

This package is intended for more advanced users with Echarts familiarity. It is not intended to be a replacement for the popular echarts4r package, which is more user-friendly and provides a higher-level interface to Echarts.

Basic example

The option argument is provided as a list of lists:

library(echartr)

echartr(option = list(
  xAxis = list(type = "category", data = c("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")),
  yAxis = list(type = "value"),
  series = list(
    list(
      name = "Example",
      type = "line",
      data = c(150, 230, 224, 218, 135, 147, 260),
      smooth = TRUE
    )
  )
))

Working with data frames

echartr provides helper functions for building Echart series from data frames

library(datasets)
library(echartr)

echartr(option = list(
  xAxis = list(type = "value"),
  yAxis = list(type = "value"),
  legend = list(show = TRUE),
  series = ec_scatter(iris,
                      
    # Data dimensions and series attributes are provided as expressions that can 
    # be evaluated for each row to build multiple series
    Petal.Length, # x
    Petal.Width, # y
    
    name = as.character(Species),
    symbol = if (Species == "versicolor") "circle" else "emptyCircle",
    itemStyle = list(
      opacity = if (Species == "setosa") 0.5 else 1
    )
  )
))

Installation

You can install the development version of echartr like so:

# install.packages("remotes")
remotes::install_github("meekalpha/echartr")

About

Use Apache Echarts in R

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors