美文网首页
尝试用recharts作图

尝试用recharts作图

作者: 雨一流 | 来源:发表于2017-04-05 16:06 被阅读0次

http://www.cnblogs.com/payton/p/5567778.html

library(recharts)

barnline<-list(

title = list(text = '测试数据'),

tooltip = list(),

legend = list(data=c('降水量','湿度')),

xAxis= list(

type= 'category',

data= y$date,

splitLine = list(show=FALSE) # 删掉竖线

),

yAxis= list(

list(

type= 'value',

name= '降水量',

min= 0,

max= ceiling(max(y$waterfall/10))*10,

interval= ceiling(max(y$waterfall/10))*10/5,

splitLine=list(

show=FALSE # 删掉横线

)

#axisLabel= list (formatter= '{value} ml')

),

list(

type= 'value',

name= '湿度',

min= 0,

splitLine=list(

show=FALSE

) ,

max= 1,

interval= 0.2 ,

axisLabel= list(formatter= JS("function(a){return a * 100 + '%';}"))

)

),

series = list(

list(

name="降水量",

type='bar',

data=y$waterfall,

itemStyle = list(

normal=list(color = '#227487', label = list(show = TRUE)) # set bar color and label

)

),

list(

name='湿度',

type='line',

yAxisIndex= 1,

data=y$humidity,

itemStyle = list(

normal=list( label = list(show = TRUE, formatter= JS("function(c){return Math.floor(c.value  * 10000)/100 + '%';}"))) # label保留小数点后两位

)

)

)

)

echart(barnline, width = 700, height =400)

相关文章

网友评论

      本文标题:尝试用recharts作图

      本文链接:https://www.haomeiwen.com/subject/oxgmgttx.html