setPolar: Set 'polar' of Echarts (For Radar Charts)

Description Usage Arguments Value References Examples

View source: R/coordsys.R

Description

Set the polar coordinates of Echarts for radar charts.
When an echart object is generated, you can modify it by setting aesthetics using %>%.

Usage

1
2
3
4
5
setPolar(chart, polarIndex = NULL, center = c("50%", "50%"),
  radius = "75%", startAngle = 90, splitNumber = 5, boundaryGap = c(0,
  0), scale = FALSE, axisLine = NULL, axisLabel = NULL,
  splitLine = NULL, splitArea = NULL, type = c("polygon", "circle"),
  indicator = NULL, axisName = NULL, ...)

Arguments

chart

echarts object generated by echart or echartR

polarIndex

Integer vector. The index of the polar systems you want to set. Default NULL.

center

Vector of the x, y position of the polar center. Could be numeric or character (percent form) vectors of length 2. Default c('50%', '50%').

radius

The radius of the polar system, could be numeric or character (percent form). Default '75%'.

startAngle

Numeric (-180 ~ 180). The start angle. Default 90.

splitNumber

Numeric. The number of sections to divide. Default 5.

boundaryGap

Numeric vector of length 2. The gapping policy of the axis. Default c(0, 0).

scale

Logical. Whether to ignore zero and zoom toward the range of _min and _max.

axisLine

List. Axis line styles. You can set its show, onZero, lineStyle features. Default list(show=TRUE).

axisLabel

List. Axis label styles. You can set its show, rotate, margin, clickable, formatter, textStyle features. Default list(show=FALSE).

splitLine

List. Split line styles. You can set its show, lineStyle features. Default list(show=TRUE).

splitArea

List. Split area styles. You can set its show, onGap, areaStyle features. Default list(show=TRUE).

type

Character, 'polygon' or 'circle'. The type of the polar shape. Default 'polygon'.

indicator

List. The radar indicator and labels. The basic structure is list(list(text='...', min=..., max=..., axisLabel=list(...)), list(text='...', min=..., max=...), list(...), ...). Default is empty.

axisName

List. The name of the axis. You can set its show, formatter, textStyle features. Default list(show=TRUE, formatter=NULL, textStyle= list(color='#333')).

...

Elipsis

Value

A modified echarts object

References

http://echarts.baidu.com/echarts2/doc/option.html#title~polar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
cars = mtcars[c('Merc 450SE','Merc 450SL','Merc 450SLC'),
              c('mpg','disp','hp','qsec','wt','drat')]
cars$model = rownames(cars)
cars = data.table::melt(cars, id.vars='model')
names(cars) = c('model', 'indicator', 'Parameter')
g = echartr(cars, indicator, Parameter, model, type='radar') %>%
         setTitle('Merc 450SE  vs  450SL  vs  450SLC')
g %>% setPolar(c(1,3), type='circle') %>%
      setPolar(2, splitArea=list(show=FALSE)) %>%
      setPolar(3, axisName=list(textStyle=textStyle(color='red')))

## End(Not run)

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