我想使用rCharts的NVD3 lineChart图表绘制不同人口的分布情况,并使用area=true选项,就像http://nvd3.org/examples/line.html中所示。
以下是我的工作内容:
require(devtools)
install_github('ramnathv/rCharts')
require(rCharts)
df<-data.frame(X=rep(1:4,2),Y=1:8,fil=c(rep("A",4),rep("B",4)))
denp <- nPlot(Y ~ X, group = 'fil', data = df, type = 'lineChart')
denp$chart(color =c('#ff7f0e', 'blue', 'green'))
denp$yAxis(axisLabel= 'Density')
denp$xAxis(axisLabel= 'Value')
denp$chart(margin = list(left=80,bottom=80))
denp$yAxis(tickFormat = "#!function (x,y,e) { return }!#")
denp$xAxis(tickFormat = "#!function (x,y,e) {
tickformat = ['0,01','0,1',1,10,100,1000,10000,'100k'];
return tickformat[x+2];}!#")
denp$chart(tooltipContent = "#! function(key, val, e, graph){
return '<h3>' + '<font color=blue>'+ key +'</font>'+ '</h3>' + '<p>'+ val } !#")
denp
我发现的问题是,我无法将区域参数切换为true。 我尝试过:
denp$chart(area=TRUE)
denp$chart(area=c(TRUE,TRUE,TRUE))
denp$chart(area=c('true'))
denp$chart(area=c('true','true','true'))
denp$chart(area=c('#!true!#'))
denp$chart(area=c('#!true!#','#!true!#','#!true!#'))
所有这些图的结果都是一张空白的图。是否有一种方法可以在rCharts中使用面积选项来绘制这种类型的图表,或者它超出了该库的范围?