A collection of annotations to add to the chart. The basic annotation allows adding custom labels or shapes. The items can be tied to points, axis coordinates or chart pixel coordinates.
Arguments
- hc
A
highcharthtmlwidgetobject.- ...
Options defined in https://api.highcharts.com/highcharts/annotations.
Details
General options for all annotations can be set using the
Highcharts.setOptions function. In this case only single objects are
supported, because it alters the defaults for all items. For
initialization in the chart constructors however, arrays of annotations
are supported.
See more in the general docs.
Examples
tokyo <- subset(highcharter::city_weather, city == "Tokyo")
monthly <- tapply(tokyo$temp_mean, format(tokyo$date, "%m"), mean)
peak <- unname(which.max(monthly))
highcharts_demo() |>
hc_annotations(list(
labels = list(list(
point = list(
xAxis = 0,
yAxis = 0,
x = peak - 1L,
y = unname(monthly[peak])
),
format = "Warmest month in Tokyo: {y:.1f} \u00b0C",
y = -14
))
))
