cosname / recharts

An interface to ECharts
https://recharts.cosx.org
BSD 3-Clause "New" or "Revised" License
337 stars 150 forks source link

双Y轴 #38

Closed c101088 closed 7 years ago

c101088 commented 7 years ago

在下查看R中帮助文档好久,似乎没有发现如何绘制双Y轴的图形。如果可以,作者可否给一示例?谢啦~~~

Lchiffon commented 7 years ago

请看这里 http://taiyun.github.io/recharts/interface.html#section-3.2.2

安装请使用:

devtools::install_github("taiyun/recharts@dev")
c101088 commented 7 years ago

真真是非常感谢!之前只是把您在上个版本的recharts包中的echart.js源码以及部分关联名称改掉,在本地自己适配一个基于echart3.0的R包,用起来虽然会报错,但是能出图。打算暑假仔细研究一下,哈哈哈,阁下真是迅速。再次感谢!

在2017年07月4日 16:55,Dawei Langnotifications@github.com 写道:

请看这里 http://taiyun.github.io/recharts/interface.html#section-3.2.2

安装请使用:

devtools::install_github("taiyun/recharts@dev")

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

GofunTR commented 6 years ago

上述链接打不开了,能否请解释一下目前怎么实现双Y轴?

c101088 commented 6 years ago

以下是我实现双Y轴绘图的方法:

  1. 按照要求安装recharts包: require(devtools) devtools::install_github('cosname/recharts')
  2. 在描述坐标轴属性时,规定yAxis有两个内容: ext<-list( xAxis=list( type="category", data=Date ), yAxis=list( list( type ="value", name="discharge(m3·s-1)", splitNumber="5", min = "0" ), list( type = "value", name = "precipitation(mm)", inverse="true", splitNumber ="5", min ="0" ) ) )
  3. 描述数据序列时,使用yAxisIndex变量确定该数据序列使用的Y轴: series<-list( list( name= "Qmea", type ="line", data = Qmea, yAxisIndex = "0" ), list( name= "Qcal", type ="line", data = Qcal, yAxisIndex = "0" ), list( name = "precipitation", type="bar", data =P, yAxisIndex = "1" ) )
  4. 使用ePlot方法完成绘图: ePlot(series,ext) @GofunTR
GofunTR commented 6 years ago

@c101088 十分感谢!