我有一个使用 R 中的 highcharter 包创建的 highcharts 极坐标图。我只想设置一条特定网格线的样式,例如下例中网格线的值为 100。示例中的代码设置所有网格线的样式。如何只指定一条网格线作为目标?我非常感谢您的建议。
library(highcharter)
df <- data.frame(y=c(123,89,106))
highchart() %>%
hc_chart(type = "line", polar = TRUE) %>%
hc_xAxis(categories = c("Category 1", "Category 2", "Category 3"),
labels = list(style = list(whiteSpace = 'nowrap'))) %>%
hc_yAxis(max = plyr::round_any(max(df$y), 10, ceiling),
gridLineColor = 'orange', gridLineWidth = 3) %>%
hc_series(
list(name = "Example chart",
data = df$y,
pointPlacement = "on",
type = "line",
color = "blue",
showInLegend = F))
一种方法是在 y 轴上的特定值处添加一条绘图线。
library(highcharter)
df <- data.frame(y=c(123,89,106))
highchart() %>%
hc_chart(type = "line", polar = TRUE) %>%
hc_xAxis(categories = c("Category 1", "Category 2", "Category 3"),
labels = list(style = list(whiteSpace = 'nowrap'))) %>%
hc_yAxis(max = plyr::round_any(max(df$y), 10, ceiling),
plotLines = list(list(value = 100,
color = 'orange',
width = 3)),
gridLineColor = 'green') %>%
hc_series(
list(name = "Example chart",
data = df$y,
pointPlacement = "on",
type = "line",
color = "blue",
showInLegend = F))