Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rChart nPlot - update yAxis label

Tags:

r

rcharts

I am currently using nPlot from rCharts package and how do I add $ signs to the y Axis?

I am thinking I need something like n1$yAxis(labels = ...) but I don't think nPlot supports this?

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

Also, it looks like nPlot is rounding to 5 significant figures (initially thought it was rounding to the nearest 10), is there a way of displaying the full value?

Thanks,

like image 504
MKa Avatar asked Oct 08 '13 05:10

MKa


1 Answers

I am posting my comment as a full solution so that it is easier for others looking for it.

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} !#")
like image 143
Ramnath Avatar answered Nov 03 '22 00:11

Ramnath