Learn R Programming

echarty (version 1.4.7)

echarty-package: echarty: Minimal R/Shiny Interface to JavaScript Library 'ECharts'

Description

Deliver the full functionality of 'ECharts' with minimal overhead. 'echarty' users build R lists for 'ECharts' API. Lean set of powerful commands.

Arguments

Package Conventions

  1. pipe-friendly - supports both %>% and |>

  2. functions have three prefixes to help with auto-completion:

  • ec. for general functions, like ec.data

  • ecs. for Shiny functions, like ecs.output

  • ecr. for rendering functions, like ecr.band

Global Options

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

  • echarty.theme = name of theme file, without extension, from folder /inst/themes

  • echarty.font = font family name

  • echarty.urltiles = tiles URL template for leaflet maps

Events

Event handling is usually necessary only in Shiny. See code in ec.examples and eshiny.R, run as demo(eshiny).
echarty has two built-in event callbacks - click and mouseover. All other ECharts events should 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 in ec.examples.

  • capture = event name(s), to monitor events usually in Shiny

  • on = define JavaScript code for event handling, see in ECharts

  • registerMap = define a map from a geoJSON file, see in ECharts

  • group = group-name of a chart, see in ECharts

  • connect = command to connect charts with same group-name, see in ECharts

  • locale = 'EN'(default) or 'ZH', set from locale parameter of ec.init, see also in ECharts.

  • renderer = 'canvas'(default) or svg, set from renderer in ec.init, see also in ECharts.

  • jcode = custom JavaScript code to execute, set from js parameter of ec.init

Code examples

Here is the complete list of sample code locations

Author

Maintainer: Larry Helgason larry@helgasoft.com [copyright holder]

Authors:

  • John Coene (echarts4r library) [copyright holder]

See Also

Examples

Run this code
# basic scatter chart from a data.frame, using presets
cars |> ec.init()

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


Run the code above in your browser using DataLab