这是我的数据框和高线图:
df1 <- structure(list(col1 = c("A", "B", "C", "D", "E", "F"), col2 = c(3.54172960518873,
4.51316494632718, 8.83778709982866, 8.9301479840624, 12.5459778934778,
12.7053222878864)), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))
df1 %>%
hchart(
"scatter",
hcaes(x = col1, y = round(col2,2)),
showInLegend = TRUE,
color = "#63696b",
name = "Title 1"
) %>%
hc_title(text ="RMSE",
align = "center",
style = list(fontSize = "18px",
fontFamily = "Roboto Condensed",
fontWeight = "bold")) %>%
hc_yAxis(
title = list(text = glue::glue("Title 2"),
name = "RMSE",
style = list(fontSize = "12px",
color = "black",
fontWeight = "900",
fontFamily = "Roboto Condensed"),
labels = list(enabled = TRUE)
))
当我悬停在点A我有这样的信息贝娄:
我想编辑它。例如,我如何将y
更改为A
并删除x
?
有什么帮助吗?
1条答案
按热度按时间pcrecxhr1#
使用
tooltip.formatter
(或者也可以使用tooltip.pointFormatter
),您可以在其中传递自定义JS代码来设置工具提示的格式。范例:
JS演示:https://jsfiddle.net/BlackLabel/fp85rgte/
API参考:https://api.highcharts.com/highcharts/tooltip.formatterhttps://api.highcharts.com/highcharts/tooltip.pointFormatter