Skip to contents

Convert data to annotation labels

Usage

data_to_annotation_labels(data, xAxis = 0, yAxis = 0)

Arguments

data

A data frame with columns x, y and text. Each row defines one label. Additional columns supply label options such as backgroundColor.

xAxis, yAxis

Axis index (starting at zero) or axis ID for the points.

Value

A list for the labels option of hc_add_annotation().

Examples

peaks <- data.frame(x = c(0, 2), y = c(5, 6), text = c("Start", "Peak"))
highchart() |>
  hc_add_series(data = c(5, 3, 6)) |>
  hc_add_annotation(labels = data_to_annotation_labels(peaks))