Here is a minimal example on how to specify a tooltip in rCharts for NVD3. Any JS literals you want to pass from R, including JS functions need to be wrapped between #!
and !#
tags so that R knows not to convert them into strings during conversion to JSON. The chart output can be seen here http://rcharts.io/viewer/?5948336
require(rCharts)
n1 <- nPlot(mpg ~ wt, group = 'gear', data = mtcars, type = 'scatterChart')
n1$chart(tooltipContent = "#! function(key, x, y){
return 'x: ' + x + ' y: ' + y
} !#")
In general, any chart method chart.x(y)
translates to n1$chart(x = y)
in rCharts, with y
being decorated with tags if required.
Hope this helps.