c_tooltip: Tooltip

Description Usage Arguments Examples

View source: R/tooltip.R

Description

Customise the tooltip.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
c_tooltip(
  c,
  enabled = TRUE,
  mode = c("nearest", "point", "index", "dataset", "x", "y"),
  intersect = TRUE,
  position = c("average", "nearest"),
  bg_color = "rgba(0, 0, 0, 0.8)",
  title_font_family = helvetica(),
  title_font_size = 12,
  title_font_style = "bold",
  title_font_color = "#fff",
  title_align = c("left", "right", "center"),
  title_spacing = 2,
  title_margin_bottom = 6,
  body_font_family = helvetica(),
  body_font_size = 12,
  body_font_style = "normal",
  body_font_color = "#fff",
  body_align = title_align,
  body_spacing = 2,
  footer_font_family = helvetica(),
  footer_font_size = 12,
  footer_font_style = "bold",
  footer_font_color = "#fff",
  footer_align = title_align,
  footer_spacing = 2,
  footer_margin_top = 6,
  x_padding = 6,
  y_padding = x_padding,
  caret_padding = 2,
  caret_size = 5,
  corner_radius = 6,
  multi_key_bg = "#fff",
  display_colors = TRUE,
  border_color = "rgba(0, 0, 0, 0)",
  border_width = 0,
  rtl = FALSE
)

Arguments

c

An object of class charter as returned by c_hart.

enabled

Whether to enable tooltips.

mode

Defines which elements appear on the tooltip.

intersect

If codeTRUE, the tooltip mode applies only when the mouse position intersects with an element. If FALSE, the mode will be applied at all times.

position

Where to position the tooltip.

bg_color

Background color of the tooltip.

title_font_family

Font of title.

title_font_size

Font size of title.

title_font_style

Font style of title.

title_font_color

Font color of title.

title_align

Horizontal alignment of the title text lines.

title_spacing

Spacing to add to top and bottom of each title line.

title_margin_bottom

Margin to add on bottom of title section.

body_font_family

Body line font.

body_font_size

Body font size.

body_font_style

Body font style.

body_font_color

Body font color.

body_align

Horizontal alignment of the body text lines.

body_spacing

Spacing to add to top and bottom of each tooltip item.

footer_font_family

Footer font.

footer_font_size

Footer font size.

footer_font_style

Footer font style.

footer_font_color

Footer font color.

footer_align

Horizontal alignment of the footer text lines.

footer_spacing

Spacing to add to top and bottom of each footer line.

footer_margin_top

Margin to add before drawing the footer.

x_padding, y_padding

Padding to add on left and right of tooltip.

caret_padding

Extra distance to move the end of the tooltip arrow away from the tooltip point.

caret_size

Size, in px, of the tooltip arrow.

corner_radius

Radius of tooltip corner curves.

multi_key_bg

Color to draw behind the colored boxes when multiple items are in the tooltip.

display_colors

If TRUE, color boxes are shown in the tooltip.

border_color

Color of the border.

border_width

Size of the border.

rtl

Renders the tooltip left to right.

Examples

1
2
3
c_hart(cars, caes(speed, dist)) %>% 
 c_line() %>% 
 c_tooltip(FALSE)

JohnCoene/charter documentation built on Feb. 20, 2022, 11:07 p.m.