Skip to content

Set Tooltip for a Gene Chart ​

This function configures the tooltip for a gene chart.

Usage ​

r
GC_tooltip(
  GC_chart,
  formatter = "<b>Start:</b> {start}<br><b>End:</b> {end}",
  show = TRUE,
  cluster = NULL,
  ...
)

Arguments ​

ArgumentDescription
GC_chartThe gene chart object to be modified.
formatterA character string defining the HTML content of the tooltip. It can include placeholders like {start} and {end} which will be replaced by actual data values. The default value shows start and end data.
showLogical, whether to display the tooltip or not.
clusterOptional; used to specify which clusters in the chart should have tooltips.
...Additional arguments that can be used to further customize the tooltip.

Value ​

Returns the gene chart object with the tooltip configured.

Examples ​

r
# Set tooltip
genes_data <- data.frame(
  start = c(10, 90, 130, 170, 210),
  end = c(40, 120, 160, 200, 240),
  name = c('Gene 1', 'Gene 2', 'Gene 3', 'Gene 4', 'Gene 5'),
  group = c('A', 'B', 'B', 'A', 'C')
)

# Add tooltips to the gene chart
GC_chart(genes_data, group = "group", height = "200px") %>%
GC_tooltip(formatter = " <b>Start:</b> {start}<br><b>end:</b> {end}")