setTimeline: Set 'timeline' of Echarts

Description Usage Arguments Value References Examples

View source: R/options.R

Description

Set timeline of Echarts when the echarts object contains timeline slices (t).
When an echart object is generated, you can modify it by setting tooltip using %>%.

Usage

1
2
3
4
5
6
7
8
setTimeline(chart, show = TRUE, type = c("time", "number"),
  realtime = TRUE, x = 80, y = NULL, x2 = 80, y2 = 0, width = NULL,
  height = 50, bgColor = "rgba(0,0,0,0)", borderColor = "#ccc",
  borderWidth = 0, controlPosition = c("left", "right", "none"),
  autoPlay = FALSE, loop = TRUE, playInterval = 2000, lineStyle = NULL,
  label = NULL, checkpointStyle = NULL, controlStyle = NULL,
  symbol = "emptyDiamond", symbolSize = 4, currentIndex = 0,
  data = NULL, ...)

Arguments

chart

echarts object generated by echart or echartR

show

Logical. If or not the timeline is shown. Default TRUE. If you want to remove timeline from the echarts object, set if NULL.

type

'time' or 'number' format of the timeline. Default 'time'.

realtime

Logical. If or not the changes take effect in realtime manner. Default TRUE.

x

x coordinate of the upper left point of the timeline bar. Default 80.

y

y coordinate of the upper left point of the timeline bar. Default NULL (automatic).

x2

x coordinate of the upper left point of the timeline bar. Default 80.

y2

y coordinate of the upper left point of the timeline bar. Default 0.

width

Width of the timeline. Could be a number or a character in percent form. Default NULL.

height

Height of the timeline. Default 50 (px).

bgColor

Background color of the timeline. Default "rgba(0,0,0,0)" (transparent).

borderColor

Border color of the timeline. Default "#ccc".

borderWidth

Border width of the timeline. Default 0 (px) (not shown).

controlPosition

Position of the control of the timeline. Could be 'left', 'right' or 'none'. Default 'left'.

autoPlay

Logical. If or not the timeline auto displays. Default FALSE.

loop

Logical. If or not the timeline displays in loop mode. Default TRUE.

playInterval

Interval when displays each timeslice. Default 2000 (ms).

lineStyle

A list. Line style of the timeline. Default value:
list(color="#666", width=1, type="dashed").
Supports features of 'color', 'width', 'type', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'

label

A list. Label style of the timeline. Default value:
list(show=TRUE, interval="auto", rotate=0, formatter=NULL,
textStyle=list(color="#333"))
.
Supports features of 'show', 'interval', 'rotate', 'formatter', 'textStyle'.

checkpointStyle

A list. Checkpoint style of the timeline. Default value:
list(symbol="auto", symbolSize="auto", color="auto",
borderColor="auto", borderWidth="auto",
label=list(show=FALSE, textStyle=list(color="auto")))
.
Supports features of 'symbol', 'symbolSize', 'color', 'borderColor', 'borderWidth', 'label'.

controlStyle

A list. Control style of the timeline. Default value:
list(itemSize=15, itemGap=5, normal=list(color="#333"), emphasis=list(color="#1e90ff")).
Supports features of 'itemSize', 'itemGap', 'normal', 'emphasis'.

symbol

Character. The symbol used in timeline. Default 'emptyDiamond'. You can use symbols in setSymbols.

symbolSize

The size of the symbols. Default 4.

currentIndex

The current index position, in correspondance with t. It is used to show specific timeline slices. Default 0.

data

The data list of the timeline, also used as timeline data label. Default NULL.

...

Elipsis

Value

A modified echarts object

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
## type = "number"
iris$tag = 1 + as.integer(row.names(iris)) %% 3
iris = iris[order(iris$tag),]
g = echartR(iris, Sepal.Width, Petal.Width, series=Species, t=tag)
g %>% setTimeline(y2=30, symbol='emptyCircle',
                  autoPlay=FALSE, data=c('tag 1', 'tag 2', 'tag 3'))

## type = "time"
### You have to use a js function to reformat the label if you want to change
### the label text
iris$date = as.Date(paste0("2013-1-", 1 + as.integer(row.names(iris)) %% 5))
iris = iris[order(iris$date),]
g = echartR(iris, Sepal.Width, Petal.Width, series=Species, t=date)
g %>% setTimeline(y2=30, symbol='emptyCircle', autoPlay=FALSE, label=list(
      formatter=JS(paste('function(s) {return s.slice(8,10) + "\u65e5";}'))))

## End(Not run)

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