Introduction to echarty"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Description

echarty provides a lean interface between R and Javascript library ECharts. We encourage users to follow the original ECharts API documentation to construct charts with echarty.
The main command ec.init can set multiple native ECharts options to build a chart.
The benefits - learn a very limited set of commands, and enjoy the full functionality of ECharts.

Package Conventions

pipe-friendly - supports both \%>\% and |>
commands have three prefixes to help with auto-completion:

Events

Event handling is usually necessary only in Shiny. See code in eshiny.R, run as demo(eshiny).
echarty has three built-in event callbacks - click, mouseover, mouseout. All other ECharts events could be initialized through p$x$capture. Another option is to use p$x$on with JavaScript handlers, see code in ec.examples.

Widget x parameters

These are htmlwidget and ECharts initialization parameters supported by echarty. There are code samples for most of them in ec.examples:

R vs Javascript numbering

R indexes are counted starting from 1.
JS indexes are counted starting from 0.
echarty supports R-counting in series-encode x,y,tooltip and visualMap-continuous dimension when set through ec.init.
All other indexes like xAxisIndex, gridIndex, etc. need to be set in JS-counting (for now).

Code examples

Here is the complete list of sample code locations:

Global Options

Options are set with R command options.
Echarty uses the following options:

# set/get global options
options('echarty.theme'='jazz') # set
getOption('echarty.theme')      # get
options('echarty.theme'=NULL)   # remove


Try the echarty package in your browser

Any scripts or data that you put into this service are public.

echarty documentation built on Oct. 16, 2023, 1:06 a.m.