setSeries: Set 'series' Element by Element

Description Usage Arguments Value References Examples

View source: R/options.R

Description

The basic framework of making Echarts object is Step 1 echart => Step 2 set[Widgets] => Step 3 set[Aesthetics]. Step 1 makes the structure of the Echarts object, step 2 creates/modifies its widgets, and step 3 modifies the params of the widgets. But what if you want to modify the details inside series list? – You may want setSeries.

setSeries is a bit low-level, compared to other set[Widgets] functions. It directly pass the param list on to an Echarts object and may lead to unexpected results. So you are suggested to get more familiar with Echarts structure before you decide to setSeries.

Usage

1
setSeries(chart, series = NULL, timeslots = NULL, ...)

Arguments

chart

chart echarts object generated by echart or echartR

series

series, could be the name or the index of the series. When the string is not in the existing series list, it will be treated as new

timeslots

vector of timeslots, either name or index of timeline variable t.

...

The params to pass to the echarts object for modification.
The generic params include:

type chart type. 'line', 'bar', 'scatter', 'k', 'pie', 'radar', 'chord', 'force', 'map'... If NULL, the series will not display.
name name of the series.
tooltip setTooltip
data the data part of echartR
itemStyle itemStyle
markPoint addMarkPoint
markLine addMarkLine
clickable whether the data graph is clickable, default TRUE.
z level-2 layer control, default 2.
zlevel level-1 layer control, default 0.


The type-specific params include:

line
stack TRUE|FALSE
xAxisIndex 0|1, default 0 (main axis)
yAxisIndex 0|1, default 0 (main axis)
symbol setSymbols
symbolSize numeric or JS function
symbolRotate -180 ~ 180
showAllSymbol TRUE|FALSE, default FALSE
smooth TRUE|FALSE, default FALSE
dataFilter only for line charts. 'nearest'|'min'|'max'|'average', default 'nearest'.
legendHoverLink TRUE|FALSE, default TRUE.
bar
stack TRUE|FALSE
xAxisIndex 0|1, default 0 (main axis)
yAxisIndex 0|1, default 0 (main axis)
barGap percent or numeric, default '30%'.
barCategoryGap percent or numeric, default '20%'.
barMinHeight numeric, default 0.
barWidth numeric, default automatic.
barMaxWidth numeric, default automatic.
legendHoverLink TRUE|FALSE, default TRUE.
scatter
xAxisIndex 0|1, default 0 (main axis)
yAxisIndex 0|1, default 0 (main axis)
symbol setSymbols
symbolSize numeric or JS function
symbolRotate -180 ~ 180
large TRUE|FALSE, default FALSE.
largeThreshold numeric, default 2000.
legendHoverLink TRUE|FALSE, default TRUE.
pie
legendHoverLink TRUE|FALSE, default TRUE.
center percent or numeric, default c('50%', '50%')
radius percent or numeric, default c(0, '75%')
startAngle numeric -360 ~ 360, default 90 for pie, 225 for gauge.
minAngle numeric, default 0.
clockWise TRUE|FALSE, default TRUE.
roseType 'radius'|'area'.
selectedOffset numeric, default 10.
selectedMode NULL|'single'|'multiple', default NULL.
radar
symbol setSymbols
symbolSize numeric or JS function
symbolRotate -180 ~ 180
legendHoverLink TRUE|FALSE, default TRUE.
polarIndex numeric. Index of the polar system to host the series.
chord
symbol setSymbols
symbolSize numeric or JS function
clockWise TRUE|FASLE, default FALSE.
categories character vector
links list of links
matrix matrix data
minRadius numeric, default 10.
maxRadius numeric, default 20.
ribbonType TRUE|FALSE, default TRUE.
showScale TRUE|FALSE, default FALSE.
showScaleText TRUE|FALSE, default FALSE
padding numeric, default 2.
sort 'none'|'ascending'|'descending', default 'none'.
sortSub 'none'|'ascending'|'descending', default 'none'.
nodes nodes list
force
symbol setSymbols
symbolSize numeric or JS function.
large TRUE|FALSE, default FALSE.
center percent or numeric, default c('50%', '50%').
roam TRUE|FALSE|'scale'|'move', default FALSE.
categories character vector
links links list
matrix data matrix
size percent or numeric, default '100%'
minRadius numeric, default 10.
maxRadius numeric, default 20.
linkSymbol vector of symbol characters, default c('none', 'arrow')
linkSymbolSize numeric verctor, default c(10, 15)
scaling numeric, default 1
gravity numeric, default 1
draggable TRUE|FALSE, default TRUE
useWorker TRUE|FALSE, default FALSE
steps numeric, default 1
nodes nodes list
map
selectedMode NULL|'single'|'multiple', default NULL
mapType 'china'|'world', default 'china'
hoverable TRUE|FALSE, default TRUE
dataRangeHoverLink TRUE|FALSE, default TRUE
mapLocation listx=.., y=.., width=.., height=.., default list(x='center', y='center')
mapValueCalculation 'sum'|'average', default 'sum'
mapValuePrecision integer, default 0
showLegendSymbol TRUE|FALSE, default TRUE
roam TRUE|FALSE|'scale'|'move', default FALSE
scaleLimit numeric list(max=.., min=..), default NULL
nameMap addNameMap
textFixed list, e.g., list(China=c(10, -10)), default NULL
geoCoord addGeoCoord
heatmap addHeatMap
gauge
legendHoverLink TRUE|FALSE, default TRUE.
center percent or numeric vector, default c('50%', '50%')
radius percent or numeric vector, default c(0, '75%')
startAngle numeric -360 ~ 360, default 225
endAngle numeric -360 ~ 360, default -45
min numeric, default 0
max numeric, default 100
splitNumber numeric, default 10
axisLine list, default list( show=TRUE, lineStyle=list( color=list(list(0.2, '#228b22'), list(0.8, '#48b'), list(1, '#ff4500')), width=30))
axisTick list, default list( show=TRUE, splitNumber=5, length=8, lineStyle=list( color='#eee', width=1, type='solid'))
axisLabel list, default list(show=TRUE, formatter=NULL, textStyle=list(color='auto'))
splitLine list, default list(show=TRUE, length=30, lineStyle=list( color='#eee', width=2, type='solid'))
pointer list, default list(length='80%', width=8, color='auto')
title list, default list(show=TRUE, offsetCenter=list(0, '40%'), textStyle=list(color='#333', fontSize=15))
detail list, default list(show=TRUE, backgroundColor='rgba(0,0,0,0)', borderWidth=0, borderColor='#ccc', width=100, height=40, offsetCenter=list(0, '40%'), formatter=NULL, textStyle=list(color='auto', fontSize=30))
funnel
legendHoverLink TRUE|FALSE, default TRUE.
sort 'ascending'|'descending', default 'descending'
min numeric, default 0
max numeric, default 100
x numeric, default 80
y numeric, default 60
x2 numeric, default 80
y2 numeric, default 60
width percent or numeric, default NULL
height percent or numeric, default NULL
funnelAlign 'left'|'right'|'center', default 'center'
minSize percent, default '0%'
maxSize percent, default '100%'
gap numeric, default 0
eventRiver
xAxisIndex 0|1, default 0 (main axis)
legendHoverLink TRUE|FALSE, default TRUE.
weight numeric, default 1
treemap
center percent or numeric vector, default c('50%', '50%')
size percent or numeric vector, default c('80%', '80%')
root name of the root displayed currently
tree
symbol setSymbols
symbolSize numeric or JS function.
roam TRUE|FALSE|'scale'|'move', default FALSE
rootLocation list, could be list(x='center' | 'left' | 'right' | 'x%' | number, y='center' | 'top' | 'bottom' | 'y%' | number)
layerPadding numeric, default 100
nodePadding numeric, default 30
orient 'vertical' | 'horizontal' | 'radial', default 'vertical'
direction "" or "inverse", default ""
wordCloud
center percent or numeric vector, default c('50%', '50%')
size percent or numeric vector, default c('80%', '80%')
textRotation vector, -90 ~ 90, default c(0, 90)
autoSize list, default list(enable=TRUE, minSize=12)
heatmap
blurSize numeric, default 30
gradientColors list(offset=.., color=..) or color vector. default list('blue', 'cyan', 'limegreen', 'yellow', 'red')
minAlpha numeric, default 0.05
valueScale numeric, default 1
opacity numeric, default 1

Value

A modified echarts object

References

http://echarts.baidu.com/echarts2/doc/option.html#title~series-i

Examples

1
2
3
4
5
## Not run: 
g = echartr(iris, Sepal.Width, Petal.Width, Species)
g %>% setSeries(series=3, symbol='emptyCircle')

## End(Not run)

madlogos/recharts2 documentation built on May 21, 2019, 11:03 a.m.