Description Usage Arguments Value References Examples
When an echart object is generated, you can modify it by setting legend using
%>%
.
You can modify the legend of the echarts object using this function.
1 2 3 |
chart |
|
show |
Logical. Show the legend or not. Default TRUE. If you want to remove legend from the echarts object, set it NULL. |
pos |
Clock position of the legend. Default 11. Refer to |
selected |
A vector of series names that are selected on load. If you assign 'none', then none of the series will be selected in the beginning. |
itemGap |
The gap between legend items. Default 5px. |
borderColor |
The border color of the legend. Default '#ccc'. |
borderWidth |
The border width of the legend. Default 0px (not shown). |
textStyle |
A list of textStyle definition to decorate the text. E.g.,
|
formatter |
A named formatter template or a string containing javascript codes.
E.g., |
overideData |
A list of data to overide the legend text. E.g.,
|
... |
Elipsis. |
A modified echarts object.
http://echarts.baidu.com/echarts2/doc/option.html#title~legend
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | \donrun{
# No timeline
g = iris %>% echartR(x=Sepal.Width, y=Petal.Width, series=Species,
type='scatter')
g %>% setLegend(selected="versicolor")
g %>% setLegend(selected=levels(iris$Species)[1:2],
textStyle=textStyle(fontFamily='Times New Roman', color='purple',
fontWeight='bold', fontSize=16))
# With Timeline
g1 = iris %>% echartR(x=Sepal.Width, y=Petal.Width, t=Species, type='scatter')
g1 %>% setLegend(pos=12, selected='none',
textStyle=list(fontFamily='Courier New', fontSize=16))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.