'hc_yaxis_multiple for add_series_list

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



Solution 1:[1]

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)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 stefan