Learn R Programming

sunburstR (version 2.1.8)

sund2bTooltip: Advanced Customization of 'd2b' Tooltip

Description

Advanced Customization of 'd2b' Tooltip

Usage

sund2bTooltip(at = NULL, followMouse = NULL, html = NULL, my = NULL)

Value

list

Arguments

at

character which should be one of "top left", "top center", "top right", "center left", "center center", "center right", "bottom center", "bottom right" to specify where the tooltip will be positioned relative to the hovered item.

followMouse

logical controlling whether the tooltip will follow the mouse instead of being placed in a static position relative to the hovered element

html

character or htmlwidgets::JS to customize the content of the tooltip. To provide a function, the arguments for the 'JavaScript' function will be 'function(nodedata, size, percent)' and the function should return a string.

my

character which should be one of "top", "left", "right", "bottom" to control the orientation of the tooltip.

Examples

Run this code
if(interactive()){

library(sunburstR)

# use a sample of the sequences csv data
sequences <- read.csv(
  system.file("examples/visit-sequences.csv",package="sunburstR")
  ,header = FALSE
  ,stringsAsFactors = FALSE
)[1:200,]

# change the tooltip
sund2b(
  sequences,
  tooltip = sund2bTooltip(
    html = htmlwidgets::JS("
function(nodedata, size, percent) {
  return '' + nodedata.name + '' + ' ' + size
}
    ")
  )
)


}

Run the code above in your browser using DataLab