Add values to rCharts hPlot tooltip

后端 未结 2 1741
天命终不由人
天命终不由人 2021-02-09 13:56

I would like to add some extra values to the standard Highcharts tooltip via rCharts. Example code:

require(rCharts)
df <- data.frame(x = c(1:5), y = c(5:1),          


        
2条回答
  •  走了就别回头了
    2021-02-09 14:10

    rCharts is a great package. But it still not well documented(Maybe I miss this point). I think you need to redefine new JS function for tooltip attribute. Any JS literals need to be wrapped between #! and !# . Here a beginning but it doesn't work as I imagine ( I think is a good start):

    h1$tooltip( formatter = "#! function() { return 'x: '     + this.point.x + 
                                                    'y: '    + this.point.y  + 
                                                    'name: '  + this.point.group; } !#")
    

提交回复
热议问题