Here is how you can modify tooltips with Morris
. You can view the final chart with code here.
mp <- mPlot(ttl ~ sex, data = dta, type = "Bar")
mp$set(hoverCallback = "#! function(index, options, content){
var row = options.data[index]
return '<b>' + row.sex + '</b>' + '<br/>' +
'ttl: ' + row.ttl + '<br/>' +
'pct: ' + row.pct
} !#")
mp
Although rCharts
tries to provide a consistent interface across multiple viz libraries, it is usually limited to data and plot aesthetics. Customization is specific to each viz library, and is different across libraries. For MorrisJS, you can look up documentation directly on the Morris Website. Any of the options can be added to the chart using the set
method.
The funny looking #!...!#
line you see in the code above is a hack to allow javascript objects like functions to be directly passed to the HTML, since otherwise they will be converted to strings.
Hope this helps.