{echarty}R Documentation

Data helper


Make data lists from a data.frame

Usage, format = "dataset", header = TRUE)



Chart data in data.frame format, required.
Except when format is 'dendrogram', then df is a list, result of hclust function.


A key on how to format the output list

  • 'dataset' = list to be used in dataset (default), or in (without header).

  • 'values' = list for customized

  • 'names' = named lists useful for named data like sankey links.

  • 'boxplot' = build dataset and source lists, see Details

  • 'dendrogram' = build series data for Hierarchical Clustering dendrogram


Boolean to include the column names in dataset, default TRUE.
Set this to FALSE when used in


format='boxplot' requires the first two df columns as:

Grouped df is supported. Groups will show in the legend, if enabled.
Returns a list(dataset, series, axlbl) to set the chart. axlbl is a formatter for the category axis.
Make sure there is enough data for computation, like >4 values per boxplot. Otherwise ECharts may exit with a Object.transform error.


A list for dataset.source, or a list of named lists.
For boxplot - a named list, see Details and Examples
For dendrogram - a tree structure, see format in tree data

See Also

some live code samples


#ds <- Orange |> relocate(age,circumference) |>'boxplot')
#ds <- Orange |> relocate(age,circumference) |> group_by(Tree) |>'boxplot')
#ds <- mtcars |> relocate(am,mpg) |>'boxplot')
 ds <- mtcars |> relocate(am,mpg) |> group_by(cyl) |>'boxplot')
p <- ec.init()
p$x$opts <- list(
  dataset= ds$dataset, 
  series=  ds$series, 
  yAxis= list(type= 'category',  # categorical yAxis = horizontal boxplots 
              axisLabel= list(formatter= ds$axlbl)),
  xAxis= list(show= TRUE),       # categorical xAxis = vertical boxplots 
  legend= list(show= TRUE)

hc <- hclust(dist(USArrests), "complete")
p <- ec.init(preset= FALSE)
p$x$opts$series <- list(list(
  type= 'tree', orient= 'TB', roam= TRUE, initialTreeDepth= -1,
  data=, format='dendrogram'),
  # layout= 'radial', symbolSize= ec.clmn(-1, scale= 0.33),
  #    exclude added labels like 'pXX', leaving only the originals
  label= list(formatter= htmlwidgets::JS(
    "function(n) { out= /p\\d+/.test( ? '' :; return out;}"))

[Package echarty version 1.4.5 Index]