ECharts
陳奎銘(Ben)
benjamin0901@gmail.com
---
<br></br>
<br></br>
<p align='center'><b><font size=7>ECharts</font></b>
<br></br>
<br></br>
<img src='/home/ben/qftrader/slidifyDemo/assets/img/Taiwan_R_slidify.png' width=300></img>
<br></br>
<b><font size=6>陳奎銘(Ben)</font></b>
<br></br>
<b><font size=6>benjamin0901@gmail.com</font></b>
</p>
--- .class #id
## ECharts
```{r,echo=FALSE,message=FALSE}
library(recharts)
library(quantmod)
library(xtable)
library(tmcn)
# Map
load(url('http://yzhou.org/recharts/ChinaGDP.RData'))
rownames(ChinaGDP)=toUTF8(rownames(ChinaGDP))
colnames(ChinaGDP)=toUTF8(colnames(ChinaGDP))
# Line
load('stock_echarts.RData')
# Pie
x=c(108248,22075,204652,102844,73251,26965,116922,25949)
names(x) =c("飲食", "衣物", "住家", "醫療", '交通', "通訊", "娛樂", '教育')
#Radar
me=data.frame(v1=77.6,v2=60,v3=60,v4=80,v5=50)
colnames(me)=c('高','富','帥','幽默','潮')
rownames(me)='Ben'
me=rbind(me,c(86.7,100,100,50,100))
rownames(me)[2]='金X5'
y=t(me)
colnames(y)=c('low','high')
y[1:5,1:2]=100
y[1:5,1]=0
```
- 作者:林峰
- <a href='http://echarts.baidu.com/index.html'>http://echarts.baidu.com/index.html</a>
- JaveScript
- 小工具
- 可以任意混搭
---
## ECharts in rCharts (author: Ramnath)
<a href='http://rcharts.io/'>http://rcharts.io/</a>
<a href='http://rcharts.io/howitworks/echarts/'>http://rcharts.io/howitworks/echarts/</a>
<iframe src='http://rcharts.io/howitworks/echarts/' width=800 height=500></iframe>
---
## recharts
- package = 包
- 作者:魏太云 周揚
- <a href='https://github.com/taiyun/recharts'>https://github.com/taiyun/recharts</a>
- R皮J骨
- data.frame or matrix
plot(ePie(x,legend.x='left',legend.y='top',main='Cost'),tag='chart')
print(ePie(x, legend.x = "left", legend.y = "top", legend.orient = "vertical",
main = "Cost"), tag = "chart")
[1] ".chart"
---
## Drag to Combine
plot(ePie(x,legend.x='left',legend.y='top',main='Cost'),tag='chart')
```{r, results='asis',echo=TRUE,message=FALSE}
print(ePie(x,legend.x='left',legend.y='top',legend.orient='vertical',main='Cost'),tag='chart')
```
print(ePoints(iris[, 3:5]), tag = "chart")
[1] ".chart"
---
## Zoom in
```{r, results='asis',echo=TRUE,message=FALSE}
print(ePoints(iris[,3:5]),tag='chart')
```
[1] ".chart"
---
## Choose Data Range and Draw Auxiliary Lines
```{r, results='asis',echo=FALSE,message=FALSE}
print(eLine(stock,opt=list(dataZoom=list(show=TRUE,end=1745))),tag='chart')
```
print(eLine(WorldPhones, opt = list(legend = list(x = "left"))), tag = "chart")
[1] ".chart"
---
## Switch Chart types
```{r, results='asis',echo=TRUE,message=FALSE}
print(eLine(WorldPhones,opt=list(legend=list(x='left'))),tag='chart')
```
print(eArea(WorldPhones, opt = list(legend = list(x = "left"))), tag = "chart")
[1] ".chart"
---
## View Data
```{r, results='asis',echo=TRUE,message=FALSE}
print(eArea(WorldPhones,opt=list(legend=list(x='left'))),tag='chart')
```
install.packages("tmcn", repos="http://R-Forge.R-project.org")
library(tmcn)
load(url('http://yzhou.org/recharts/ChinaGDP.RData'))
rownames(ChinaGDP)=toUTF8(rownames(ChinaGDP))
colnames(ChinaGDP)=toUTF8(colnames(ChinaGDP))
print(eMap(ChinaGDP),tag='chart')
---
## Map
install.packages("tmcn", repos="http://R-Forge.R-project.org")
library(tmcn)
load(url('http://yzhou.org/recharts/ChinaGDP.RData'))
rownames(ChinaGDP)=toUTF8(rownames(ChinaGDP))
colnames(ChinaGDP)=toUTF8(colnames(ChinaGDP))
print(eMap(ChinaGDP),tag='chart')
[1] ".chart"
---
## Map
```{r,results='asis',echo=FALSE,message=FALSE,warning=FALSE}
print(eMap(ChinaGDP,opt=list(dataRange=list(color=c('red','yellow')))),tag='chart')
```
print(eRadar(me, limit = y), tag = "chart")
[1] ".chart"
---
## Save Image
```{r,results='asis',message=FALSE,warning=FALSE}
print(eRadar(me,limit=y),tag='chart')
```
print(eForce(networkMatrix = networkMatrix, propertyDf = propertyDf), tag = "chart")
[1] ".chart"
---
## Force
```{r,results='asis',message=FALSE,warning=FALSE,echo=FALSE}
networkMatrix <- matrix(c(
c(0, 1, 2, 1, 2, 3, 6, 6, 1, 1, 1 ),
c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ),
c(2, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0 ),
c(1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0 ),
c(2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ),
c(3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ),
c(6, 0, 1, 1, 1, 1, 0, 6, 0, 1, 0 ),
c(6, 0, 0, 1, 0, 0, 6, 0, 0, 0, 0 ),
c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ),
c(1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ),
c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
), ncol=11
)
propertyDf <- data.frame(
category = c("人物", "家人", "家人", "家人", "家人", "朋友",
"朋友", "朋友", "朋友", "朋友", "朋友"),
name = c("Steven Jobs", "Lisa Jobs", "Paul Jobs", " Kalala Jobs",
"Lauren Powell", "Steve woz Ike", "Obama", "Bill Gates",
"Jonathan", "Tim Cook", "Wayne"),
value = c(10, 2, 3, 3, 7, 5, 8, 9, 4, 4, 0)
)
rownames(propertyDf) = propertyDf$name
```
```{r,results='asis',message=FALSE,warning=FALSE}
print(eForce(networkMatrix=networkMatrix, propertyDf=propertyDf),tag='chart')
```
---
## K Line
<iframe src='http://echarts.baidu.com/doc/example/k1.html' width=800 height=500></iframe>
---
## Mix
<iframe src='http://echarts.baidu.com/doc/example/mix2.html' width=800 height=500></iframe>
---
## Lasagna
<iframe src='http://echarts.baidu.com/doc/example/lasagna.html' width=800 height=500></iframe>
---
## Dynamic
<iframe src='http://echarts.baidu.com/doc/example/dynamicLineBar.html' width=800 height=500></iframe>
| Table of Contents | t |
|---|---|
| Exposé | ESC |
| Full screen slides | e |
| Presenter View | p |
| Source Files | s |
| Slide Numbers | n |
| Toggle screen blanking | b |
| Show/hide slide context | c |
| Notes | 2 |
| Help | h |