hc_yaxis_multiple 用于 add_series_list

发布于 2025-01-14 02:19:11 字数 610 浏览 1 评论 0原文

我想在 highchart 中有多个 y 轴,但出于某种原因第二个轴只显示名称而不显示值,下面是一个示例,

ds <- lapply(seq(1), function(x) {
  list(data = cumsum(rnorm(100, 2, 5)), name = "1")
})

da <- lapply(seq(1), function(x) {
  list(data = cumsum(rnorm(100, 2, 5)), name = "2")
})

highchart() %>%
  hc_plotOptions(series = list(marker = list(enabled = FALSE))) %>%
  hc_yAxis_multiples(list(title = list(text = "Retention"), opposite = FALSE),
                     list(showLastLabel = TRUE, opposite = TRUE, title = list(text = "Limit")))%>%
  hc_add_series_list(ds)%>%
  hc_add_series_list(da)

谢谢

i want to have multiple y axis in highchart, but for any reason the second axis only display the name but not values, below here is an example,

ds <- lapply(seq(1), function(x) {
  list(data = cumsum(rnorm(100, 2, 5)), name = "1")
})

da <- lapply(seq(1), function(x) {
  list(data = cumsum(rnorm(100, 2, 5)), name = "2")
})

highchart() %>%
  hc_plotOptions(series = list(marker = list(enabled = FALSE))) %>%
  hc_yAxis_multiples(list(title = list(text = "Retention"), opposite = FALSE),
                     list(showLastLabel = TRUE, opposite = TRUE, title = list(text = "Limit")))%>%
  hc_add_series_list(ds)%>%
  hc_add_series_list(da)

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

飞烟轻若梦 2025-01-21 02:19:11

您必须通过为一个(且仅针对一个)系列设置 yAxis 参数来指定要在主 y 轴上显示哪个系列:

set.seed(123)

ds <- lapply(seq(1), function(x) {
  list(data = cumsum(rnorm(100, 2, 5)), name = "1")
})

da <- lapply(seq(1), function(x) {
  list(data = cumsum(rnorm(100, 2, 5)), name = "2", yAxis = 1)
})

library(highcharter)

highchart() %>%
  hc_plotOptions(series = list(marker = list(enabled = FALSE))) %>%
  hc_yAxis_multiples(list(title = list(text = "Retention"), opposite = FALSE),
                     list(showLastLabel = TRUE, opposite = TRUE, title = list(text = "Limit")))%>%
  hc_add_series_list(ds)%>%
  hc_add_series_list(da)

You have to specify which of the series you want to display on the primary y-axis by setting the yAxis argument for one (and only for one) series:

set.seed(123)

ds <- lapply(seq(1), function(x) {
  list(data = cumsum(rnorm(100, 2, 5)), name = "1")
})

da <- lapply(seq(1), function(x) {
  list(data = cumsum(rnorm(100, 2, 5)), name = "2", yAxis = 1)
})

library(highcharter)

highchart() %>%
  hc_plotOptions(series = list(marker = list(enabled = FALSE))) %>%
  hc_yAxis_multiples(list(title = list(text = "Retention"), opposite = FALSE),
                     list(showLastLabel = TRUE, opposite = TRUE, title = list(text = "Limit")))%>%
  hc_add_series_list(ds)%>%
  hc_add_series_list(da)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文