title: Adding information to xAxis - r shiny
body: <p>I have an issue with some plots in Rshiny. I would like to add some information to the xAxis. This post was edited because I almost found a solution, but if you want the original script, I can provide it.</p>
  
  <p>Here is a reproductible example :</p>
  
  <pre><code> library("shiny")
  library("highcharter")
  
  data(citytemp)
  
  ui &lt;- fluidPage(
      h1("Highcharter EXAMPLE"),
      fluidRow(
          column(width = 8,
                 highchartOutput("hcontainer",height = "500px")
          ),
          selectInput("option", label = "",  width = "100%",
                      choices = c("Tokyo", "NY"))
      )
  )
  
  server &lt;- function(input, output) {
      data &lt;- citytemp[,c("month","tokyo","new_york")]
      data = data[data$month%in%c("Dec","Jan","Feb","Mar"),]
      choose_Option &lt;- reactive({
          sort_option &lt;- input$option
          if(sort_option=="Tokyo"){
              data = data[order(data$tokyo),]
          }
          else{
              data = data[order(data$new_york),]
          }
          return(data)
      })
      output$hcontainer &lt;- renderHighchart({
          data = choose_Option()
          data = data[1:3,] 
  
  
          chart &lt;-  highchart() %&gt;% 
              hc_chart(type = "bar") %&gt;% 
              hc_title(text = "Monthly Average Temperature for main cities") %&gt;% 
              hc_subtitle(text = "Source: WorldClimate.com") %&gt;% 
              hc_xAxis(categories = data$month ,                    
                       labels=list(
                           formatter=JS("function () {
                               return 'Tokyo' + '&lt;br&gt;' +  this.categories  +'         '  + '&lt;br&gt;'+'NY' + '&lt;/br&gt;';
                           }"))) %&gt;% 
              hc_yAxis(title = list(text = "Temperature (C)")) 
  
          hc &lt;- chart %&gt;% hc_add_series(yAxis=0,name="Tokyo",data = data$tokyo,colorByPoint=TRUE )
          hc &lt;- hc %&gt;% hc_add_series(yAxis=0,name="NY",data = data$new_york,colorByPoint=TRUE )    
  
  
  
          return(hc)
      })
  } 
  
  shinyApp(ui = ui, server = server)
  </code></pre>
  
  <p>Here is an illustration of what I would like to have:</p>
  
  <p><a href="https://i.stack.imgur.com/Qqg1n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qqg1n.png" alt="enter image description here"></a></p>
  
  <p>The solution is almost working but I face two problems:
   1) how can I ask R to get the category name ? I think that this.category is not working ... and 2) why is the long whitespace not taken into account ?</p>
  
  <p>Let me know if you need any clarification.
  Thank you very much, 
  Best, Madzia</p>