ec.init {echarty}R Documentation

Initialize command


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


  df = NULL,
  group1 = "scatter",
  preset = TRUE,
  load = NULL,
  js = NULL,
  width = NULL,
  height = NULL,
  elementId = NULL,
  renderer = "canvas",



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


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.


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


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.


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.


Id of the widget, default NULL


'canvas' (default) or 'svg'.


Any other arguments to pass to the widget.


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.


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


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

[Package echarty version 0.2.0 Index]