Search code examples
rr-highcharter

How to remove "Values" from R Highcharter


highchart() %>% 
  hc_yAxis_multiples(
    list(lineWidth = 3),
    list(showLastLabel = FALSE, opposite = TRUE),
    list(title = list(text = "<b>Sepal Length<b>",margin = 20),opposite = FALSE),
    list(title = list(text = "<b>Petal Length<b>", margin = 20), opposite = TRUE)
  ) %>% 
  hc_xAxis(categories = iris$Species) %>%
  hc_add_series(name = "Sepal Length", data = iris$Sepal.Length,type="column", yAxis=0, color ="#ff9400") %>% 
  hc_add_series(name = "Petal Length", data = iris$Petal.Length, type="column", yAxis=1, color ="#7fadf0")

I'm using hc_yAxis_multiples to add an additional Y-axis. I'd like to remove the text label "Values" on both sides of the Y-axis.

I found a similar post about this problem: How to remove "Values" and "series" from highcharts?, but it's in Java and the example has only one Y-axis.


Solution

  • Try this one :

    highchart() %>% 
      hc_yAxis_multiples(
        list(title=list(text="<b>Sepal Length<b>",margin = 20),
             lineWidth = 3,showLastLabel = FALSE,opposite = FALSE),
        list(
          title=list(text="<b>Petal Length<b>", margin = 20),
          lineWidth = 3,showLastLabel = FALSE,  opposite = T)
      ) %>% 
      hc_xAxis(categories = iris$Species) %>%
      hc_add_series(name = "Sepal Length", data = iris$Sepal.Length,type="column", yAxis=0, color ="#ff9400") %>% 
      hc_add_series(name = "Petal Length", data = iris$Petal.Length, type="column", yAxis=1, color ="#7fadf0")