ec.init {echarty}R Documentation

Initialize command

Description

Required to build a chart. In most cases this will be the only command necessary.

Usage

ec.init(
  df = NULL,
  group1 = "scatter",
  preset = TRUE,
  load = NULL,
  js = NULL,
  width = NULL,
  height = NULL,
  elementId = NULL,
  renderer = "canvas",
  ...
)

Arguments

df

A data.frame to be preset as dataset, default NULL
For crosstalk df should be of type SharedData.

group1

Type of grouped series, or type of first ungrouped serie. Default is 'scatter'. Set to NULL to disable.
If the grouping is on multiple columns, only the first one is used.

preset

Disable(FALSE) or enable (TRUE, default) presets xAxis,yAxis,serie for 2D, or grid3D,xAxis3D,yAxis3D,zAxis3D for 3D.

load

Name(s) of plugin(s) to load. Could be a character vector or comma-delimited string. default NULL.
Built-in plugins:

Plugins with one-time installation (popup prompt):

  • 3D - 3D charts and WebGL acceleration, see source and docs

  • world - world map with country boundaries, see source

  • liquid - liquid fill, see source

  • gmodular - graph modularity, see source

  • wordcloud - cloud of words, see source

Install you own plugins with ec.plugjs.

js

A Javascript expression to evaluate, default NULL.

width, height

A valid CSS unit (like '100%', '500px', 'auto') or a number, which will be coerced to a string and have 'px' appended.

elementId

Id of the widget, default NULL

renderer

'canvas' (default) or 'svg'.

...

Any other arguments to pass to the widget.

Details

Command ec.init creates a widget with createWidget, then adds some ECharts features to it.
When ec.init is chained after a data.frame, a dataset is preset.
When the data.frame is grouped and group1 is not null, more datasets with legend and series are also preset. Grouped series are preset as type scatter.
Plugin '3D' presets will not work for 'scatterGL'. Instead, use preset=FALSE and set explicitly xAxis,yAxis.
Users can delete or overwrite any presets as needed.

Value

A widget to plot, or to save and expand with more features.

Examples

 # basic scatter chart from a data.frame, using presets
 cars %>% ec.init()
 

[Package echarty version 0.2.0 Index]