# May not work render HTML correctly in RStudio viewer
# Open in browser
mtcars |>
e_charts(mpg) |>
e_scatter(wt) |>
e_annotations(
annotations = list(
list(
id = 0,
x = 15,
y = 3,
text = 'An annotationwith style',
offsetX = 0,
offsetY = -50,
textStyle = list(
"font-size" = 14,
"font-weight" = 'bold',
color = "#394",
padding_trbl = list(0, 0, 5, 0)
),
rectStyle = list(
`stroke-dasharray` = c(35, 10),
`stroke-width` = 2,
# Shadow can be added!
shadow = list(
dx= 0,
dy= 2,
blur= 4,
color= '#000',
opacity= 0.3
),
shape = list(width = 105, height = 50, r = 0)
),
lineStyle = list(`stroke-width` = 2),
arrowStyle = list(size = 8)
),
# No styles, will just show text
list(
id = 0,
x = 25,
y = 1,
text = 'No styles',
lineStyle = "none",
rectStyle = "none",
arrowStyle = "none"
),
# Default style
list(
id = 2,
x = 25,
y = 4.5,
text = "Default style",
offsetX = 0,
offsetY = -40
),
# left-aligned annotation
list(
id = 2,
x = 0,
y = 0.5,
text = "I'm leftaligned!",
offsetX = 60,
offsetY = -40,
textStyle = list(
"text-anchor" = "start",
padding_trbl = list(0, 0, 6, 10)
)
)
))
Run the code above in your browser using DataLab