Description Usage Arguments Value Self-defined Themes (UDT) References See Also Examples
Set the entire theme of Echarts. You can use a pre-installed theme or define
you own themes.
You can also set aesthetics of Echarts separately, including color, bgColor,
animation, calculable, borderColor, borderWidth.
When an echart object is generated, you can modify it by setting aesthetics using
%>%.
1 2 3 4 5 6 | setTheme(chart, theme = c("asis", "default", "macarons", "infographic",
"blue", "dark", "gray", "green", "helianthus", "macarons2", "mint", "red",
"roma", "sakura", "shine", "vintage"), palette = "asis", bgColor = NULL,
renderAsImage = FALSE, calculable = FALSE, calculableColor = NULL,
calculableHolderColor = NULL, animation = TRUE, animationEasing = NULL,
animationDuration = NULL, width = NULL, height = NULL, ...)
|
chart |
|
theme |
|
palette |
name of the palette or a color vector. Default NULL to get echarts default. It could be:
Usage:
|
bgColor |
Color name/value of the background. Default is transparent
( |
renderAsImage |
Logical. If TRUE, the interactive effects are disabled. Default FALSE. |
calculable |
Logical. If TRUE, the chart is re-calculated after drag. Default FALSE. |
calculableColor |
The border color of the tooltip during |
calculableHolderColor |
The color of |
animation |
Logical. If TRUE, the animation is on at initiation. Default TRUE. For IE8, it is recommended to set FALSE. |
animationEasing |
The slight moving effect of major elements. Default 'ExponentialOut'. Other choices: 'Linear', 'QuadraticIn', 'QuadraticOut', 'QuadraticInOut', 'CubicIn', 'CubicOut', 'CubicInOut', 'QuarticIn', 'QuarticOut', 'QuarticInOut', 'QuinticIn', 'QuinticOut', 'QuinticInOut', 'SinusoidalIn', 'SinusoidalOut', 'SinusoidalInOut', 'ExponentialIn', 'ExponentialInOut', 'CircularIn', 'CircularOut', 'CircularInOut', 'ElasticIn', 'ElasticOut', 'ElasticInOut', 'BackIn', 'BackOut', 'BackInOut', 'BounceIn', 'BounceOut', 'BounceInOut' |
animationDuration |
The duration into animation. Default 2000 (ms). |
width |
Width (px) of the whole chart. |
height |
Height (px) of the whole chart. |
... |
Elipsis |
A modified echarts object
You can design your prefered themes using
http://echarts.baidu.com/echarts2/doc/example/themeDesigner.html.
The UDTs in echarts are JS objects. You can write it in a list form
and setTheme will parse it into JSON string for process.
A typical theme JS looks like:
{
color: ['#ff7f50','#87cefa','#da70d6','#32cd32','#6495ed'],
title: {x: 'left', y: 'top'},
legend: {orient: 'horizontal'}
}
You should write in the format below:
list(color=c('#ff7f50','#87cefa','#da70d6','#32cd32','#6495ed'),
title=list(x='left', y='top'), legend=list(orient='horizontal'))
theme
http://echarts.baidu.com/echarts2/doc/example/theme.html
backgroundColor
http://echarts.baidu.com/echarts2/doc/option.html#title~backgroundColor
colors
http://echarts.baidu.com/echarts2/doc/option.html#title~color
http://colorbrewer2.org
other features
http://echarts.baidu.com/echarts2/doc/option.html#title~renderAsImage
http://echarts.baidu.com/echarts2/doc/option.html#title~calculable
http://echarts.baidu.com/echarts2/doc/option.html#title~animation
http://echarts.baidu.com/echarts2/doc/option.html#title~calculableColor
http://echarts.baidu.com/echarts2/doc/option.html#title~calculableHolderColor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ## Not run:
g = echartR(iris, Sepal.Width, Petal.Width, series=Species)
# Set themes
## pre-installed themes
g %>% setTheme("infographic")
g %>% setTheme("blue")
g %>% setTheme("dark")
g %>% setTheme("gray")
g %>% setTheme("green")
g %>% setTheme("helianthus")
g %>% setTheme("macarons2")
g %>% setTheme("mint")
g %>% setTheme("red")
g %>% setTheme("sakura")
g %>% setTheme("shine")
g %>% setTheme("vintage")
## self-defined themes
theme = list(color=c("#7AC143", "#7D3F98", "#F47721", "#D20962", "#00A78E",
"#00BCE4", "#B8D936", "#EE3D94"), backgroundColor="#fef8ef")
g %>% setTheme(theme)
## Misc aethetics
g = echartR(iris, x=Sepal.Width, y=Petal.Width, series=Species, type='scatter')
g %>% setTheme(palette='hc')
g %>% setTheme(palette=c('red', 'gold', 'deepskyblue'), 'gray95',
animationHoldColor='red', animationEasing='CircularOut',
animationDuration=10000)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.