Create a tooltip for SveltePlots charts
sp_tooltip.Rd
This function creates a customizable tooltip for SveltePlots charts. Tooltips provide additional information when hovering over data points.
Usage
sp_tooltip(
sp,
type = NULL,
format = NULL,
background_color = "white",
opacity = 0.8,
text_color = "black",
border_color = NULL,
border_width = 1,
font_size = 12,
font_family = "Arial, sans-serif",
padding = 5,
position = NULL,
show_delay = 0,
animation = FALSE,
animation_params = NULL,
justify_content = "space-between",
cross_hair = FALSE
)
Arguments
- sp
The SveltePlots object to attach the tooltip to.
- type
The type of tooltip, "shared" or "single". Default depends on the x-axis and is shared for date and factors and single for numeric.
- format
The format of tooltip content.
- background_color
Background color of the tooltip (default: "white").
- opacity
Numeric value between 0 and 1 specifying the opacity of the tooltip (default: 0.8).
- text_color
Text color of the tooltip (default: "black").
- border_color
Border color of the tooltip (default: "#cccccc").
- border_width
Border width of the tooltip (default: 1).
- font_size
Font size of the tooltip text (default: 12).
- font_family
Font family of the tooltip text (default: "Arial, sans-serif").
- padding
Padding around the tooltip content (default: 5).
- position
Position of the tooltip relative to the data point ("top", "bottom", "left", "right").
- show_delay
Delay in milliseconds before showing the tooltip (default: 0).
- animation
Whether to animate the tooltip (default: FALSE).
- animation_params
A list containing animation parameters for multiple series when type = "shared":
- duration
The duration of the animation in milliseconds. Default is 0.
- delay
The delay before the animation starts in milliseconds. Default is 0.
- justify_content
How to justify the content inside the tooltip (default: "space-between").
- cross_hair
Whether to enable crosshair (default: FALSE).