Consider the plot, pulled from the rCharts/NVD3 examples page
p6 <- nPlot(uempmed ~ date, data = economics, type = 'lineChart')
p6
I tried to get my y-axis to display percentages, so I tried the following code (following R: interactive plots (tooltips): rCharts dimple plot: formatting axis) but it returns a blank page
p6 <- nPlot(uempmed ~ date, data = economics, type = 'lineChart')
p6$yAxis(outputFormat = "%")
p6
I did some research and got the following to work:
p6 <- nPlot(uempmed ~ date, data = economics, type = 'lineChart')
p6$yAxis(tickFormat = "#! function(d) {return d*100 + '%' } !#")
p6
Now, I know about 0 javascript and want to stay in R as much as possible, at least in the short term. Could someone let me know
- Why the first approach doesn't work, and
- Whether the second approach is the best way to go about it