First, you should load recharts:

library(recharts)

1 Introduction

SymbolList is a vector of symbol names. You can use setSymbols to define your own symboList. The symbolList is used along with series in a looping manner.

The recommended approach to use setSymbols is chart %>% setSymbols(...).

2 Function Call

All the function names have two forms: small camel and lowercase_underscore (endorsed by Hadley Wickham). To be lazy, we also provide short forms as well (e.g., sl for symbolList).

setSymbols(chart, symbols = NULL, ...)

set_symbols(chart, symbols = NULL, ...)

set_symbol(chart, symbols = NULL, ...)

set_sl(chart, symbols = NULL, ...)
Arg Requirement

chart

Echarts object generated by echartR or echart.

symbols

A vector assigning symbols. You can use an array of symbols. If the the symbols array is shorter than the levels of the series in length, the last symbol will be used to extend the array. Default NULL.

  • If you set symbolList NULL or leave it unset, the function circulates the default symbol list of Echarts: c('circle', 'rectangle', 'triangle', 'diamond', 'emptyCircle', 'emptyRectangle', 'emptyTriangle', 'emptyDiamond').
  • You can also assign non-standard symbols, such as 'heart', 'droplet', 'pin', 'arrow', 'star3', 'star4', 'star5', 'star6', 'star7', 'star8', 'star9', etc.
  • When assigned to ‘none’, no symbol will be shown, you can thus yield lines without points on it.
  • The elements not in the above eligible symbols list will be eliminated.

Elipsis.

3 Showcase

g <- echartr(iris, Sepal.Width, Petal.Width, Species)
g

The three series are displayed as ‘circle’, ‘rectangle’ and ‘triangle’. You can overide it by assigning another vector.

g %>% setSymbols(symbols=c('diamond', 'emptycircle', 'emptyrectangle'))

If the symbolList is shorter than the length of series, the last element in the symbolList will be repeated.

g %>% setSymbols(symbols=c('diamond', 'emptycircle'))

And some non-standard symbols are also usable.

g %>% setSymbols(c('pin', 'heart', 'star8'))