rChart nPlot-更新yAxis标签

rChart nPlot-更新yAxis标签,r,rcharts,R,Rcharts,我目前正在使用rCharts软件包中的nPlot,如何向y轴添加$signs 我想我需要像n1$yAxis(labels=…)这样的东西,但我认为nPlot不支持这个 test <- data.frame(object = c("A", "B"), price = c(111333, 876176)) test$Test <- "TEST" n1 <- nPlot(price~Test, group = "object", data = test, type = "multiB

我目前正在使用rCharts软件包中的nPlot,如何向y轴添加$signs

我想我需要像
n1$yAxis(labels=…)
这样的东西,但我认为nPlot不支持这个

test <- data.frame(object = c("A", "B"), price = c(111333, 876176))
test$Test <- "TEST"
n1 <- nPlot(price~Test, group = "object", data = test, type = "multiBarChart")

test我将我的评论作为一个完整的解决方案发布,以便其他人更容易找到它

require(rCharts) # install the latest from the dev branch
test <- data.frame(object = c("A", "B"), price = c(111333, 876176))
test$Test <- "TEST"
n1 <- nPlot(price~Test, group = "object", data = test, type = "multiBarChart")
n1$yAxis(tickFormat = "#! function(d) {return '$' + d} !#")
require(rCharts)#从dev分支安装最新版本

测试您想在y轴标题中添加一个美元符号吗?我刚刚对
rCharts
dev
分支进行了修复。转换为json时,它使用13位数字,可以使用
选项('rcharts.digits')
@Michele进行控制。我想在y轴标签上添加美元符号,例如,类似于scale的scale_y_continuous(“Price”,labels=dollar)package@Ramnath那么我必须重新安装rCharts包吗?是的<代码>开发工具::安装_github('rCharts','ramnathv',ref='dev')
感谢Ramnath,他添加了美元符号,但去掉了,'1000分隔符。如何同时添加$and和分隔符?请尝试n1$yAxis(tickFormat=“#!函数(d){return'$'+d3.format(',.2f')(d)}!#”),这太棒了。除了运行示例之外,从未做过任何事情。。。通过
yAxis
方法,您可以提供命名字符串(包含JS函数!)来定义
yAxis
的每个部分(这里的勾选格式)@Ramnath我在哪里可以找到关于rCharts更详细的信息?
rCharts
的r文档非常有限。Thanks@Michele目前文档很薄,我们正在处理它。以下是我如何按照本文
n1$yAxis(tickFormat=“#!function(d){return d3.format('.0%')(d)}!#”)中的思路完成百分比的参考信息