RPlot tooltip issues

I have a simple example of using tooltips with rCharts that doesn't seem to work:

set.seed(1)
test <- data.frame(x = rnorm(100), y = rnorm(100))
rPlot(y ~ x, data = test, 
      type = 'point',
      tooltip = "function(item){return item.x + '\n' + item.name + '\n' + item.y}") 

A blank page appears. There is a plot if I remove the tooltip option. I am using rCharts_0.4.1, R In development on x86_64-apple-darwin10.8.0 (64-bit) and version 31.0.1650.63 of Chrome.

Bonus question! Can prompts contain variables in a dataset but not be used in x, yetc.? I have a large data set, and I would like to annotate data points with an ID variable that has a unique value for each row.

Thanks,

Max

+4
source share
2 answers

Rcharts 0.4.2

, , , , , , js :

"#!function(item) { return item.x }!#"

set.seed(1)
test <- data.frame(x = rnorm(100), y = rnorm(100), id = 1:100)
p <- rPlot(y ~ x, data = test, 
        type = 'point',
        tooltip = "#!function(item){ return 'x: ' + item.x + 
        ' y: ' + item.y + ' id: ' + item.id }!#")

. , p$show('inline') , . , , JS- , . , , .replace('\\n', '\n'), , , .

, , p$save('filepath.html') . , .

+4

/ rCharts 0.3.51 (Chrome 31.0.1650.63 m, Win7 x64):

set.seed(1)
require(rCharts)
test <- data.frame(x = rnorm(100), y = rnorm(100), 
                   name=replicate(100, paste(sample(letters, 5, rep=T), collapse="")))
rPlot(y ~ x, data = test, 
      type = 'point',
      tooltip = "function(item){return item.x + '\n' + item.name + '\n' + item.y}")

test - name.

enter image description here

0

All Articles