ramnathv / rCharts

Interactive JS Charts from R
http://rcharts.io
Other
1.19k stars 654 forks source link

unable to change tooltip text #648

Open trotter12 opened 9 years ago

trotter12 commented 9 years ago

Hi,

PFB my code:

lmfit = lm( as.matrix(Data[1])~as.matrix(Data[2]) ) dat = fortify(lmfit, data = Data)

names(dat) = gsub('.', '_', names(dat))

p1 <- rPlot(OAS~OASD, data = dat, type = 'point') p1$layer(y = '_fitted', copy_layer = T, type = 'line', color = list(const = 'red'), tooltip = "function(item){#! return item.Cusip} !#") p1

Despite changing the value in the function for tooltip, I am still getting teh default x and y values. How can I change the text of the tooltip?

Thanks

mickeyvip commented 9 years ago

I am not an expert, but it seems you have the first #! not in the beginning of the JavaScript code.

I think it should be:

tooltip = "#! function(item) { return item.Cusip; } !#"

Hope that helped.