Ich habe eine gestapelte Säulenzeichnung, wo ich eine Textanmerkung unter jeder Spalte brauche. Ich habe nur eine Möglichkeit gefunden, eine Annotation hinzuzufügen. Das Hinzufügen einer zweiten Anmerkung ergibt den Fehler All arguments must be named list
. Leider weiß ich, wie man die Funktion hc_annotations benutzt.Highcharter - mehrere Textanmerkungen hinzufügen
Hier ist ein kleines Arbeitsbeispiel und Codebits Ich habe versucht:
hc <- highchart() %>%
hc_chart(type = "column") %>%
hc_plotOptions(column = list(stacking = "normal")) %>%
hc_title(text = "Plot with Annotations", useHTML = TRUE) %>%
hc_yAxis(title = "") %>%
hc_xAxis(title = "") %>%
hc_xAxis(categories = c("A", "B", "C", "D", "E"))
hc <- hc %>%
hc_add_series(name = "S1", data = c(5, 1, 2, 4, 5),
dataLabels = list(format='{point.y:,.1f}', align = "center", enabled = TRUE))
hc <- hc %>%
hc_add_series(name = "S2", data = c(-1, -4, 3, -2, -4),
dataLabels = list(format='{point.y:,.1f}', align = "center", enabled = TRUE))
##try to add annotations
#1
hc <- hc %>%
hc_annotations(list(xValue = 0, yValue = -2, title = list(text = '-6 pp')))
hc <- hc %>%
hc_annotations(list(xValue = 1, yValue = -8, title = list(text = '-5 pp')))
#2 - basically the same as #1
hc <- hc %>%
hc_annotations(list(xValue = 0, yValue = -2, title = list(text = '-6 pp'))) %>%
hc_annotations(list(xValue = 1, yValue = -8, title = list(text = '-5 pp')))
#3
hc <- hc %>%
hc_annotations(list(list(xValue = 0, yValue = -2, title = list(text = '-6 pp')),
list(xValue = 0, yValue = -8, title = list(text = '-5 pp')))
)
hc
habe ich gerade hier zwei Anmerkungen als Vitrine. In meinem letzten Code brauche ich eine Anmerkung unter jeder Spalte.
Vielen Dank! –