sund2bTooltip: Advanced Customization of 'd2b' Tooltip

View source: R/d2b.R

sund2bTooltipR Documentation

Advanced Customization of 'd2b' Tooltip

Description

Advanced Customization of 'd2b' Tooltip

Usage

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

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.

Value

list

Examples

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 '<span style=\"font-weight: bold;\">' + nodedata.name + '</span>' + ' ' + size
}
    ")
  )
)


}

sunburstR documentation built on Feb. 16, 2023, 6:37 p.m.