title: Display both the series legend and a colorAxis legend with dataClasses using highcharts in R
body: <p>I'm wondering if it's possible to display both the series legend and a colorAxis legend using <strong>dataClasses</strong> in the same plot in highcharts.</p>
  <p>Edit: I previously included a question. Which I now believe to be irrelevant to mine. <a href="https://stackoverflow.com/questions/59323741/display-legend-and-coloraxis-at-different-positions-in-highchart">Past question</a></p>
  <p>I'm currently creating a highcharts heatmap using data classes and a line series that over lays on top. Initially, I had one line series so it wasn't an issue to have it always be displaying, since it's not included in the legend. But I've been tasked with including more lines series and now need the above functionality.</p>
  <p>It appears to me that enabling dataClasses in the colorAxis removes the option to show a series legend. Since the plot shows both the colorAxis and series legend when removing dataClasses.</p>
  <p>Below is a snippet of my code. I've copied over the events load callback function from the question above.</p>
  <p>I'm using the <code>R</code> package/version <code>highcharter_0.9.4</code> which is based on HighchartsJS 9.3.1</p>
  <pre><code>hchart(census, &quot;heatmap&quot;, hcaes(x = &quot;times&quot;, y = &quot;bed_labels&quot;, value = &quot;pat_state&quot;), name=&quot;occupied&quot;) %&gt;%
        hc_subtitle(text = paste0(display.name,&quot; &lt;br&gt; &quot;, unique(daily.string))) %&gt;%
        hc_tooltip(formatter = fn_tltp, shared=FALSE) %&gt;%
        hc_colorAxis(dataClasses = color_axis) %&gt;%
        hc_chart(marginRight = 80,
                 events = list(
                   load = htmlwidgets::JS(&quot;function() {
                             console.log(this.colorAxis[0])
                             console.log(this.colorAxis[0].axisParent) # undefined
                             
                             var chart = this,
                                 colorAxis = chart.colorAxis[0].axisParent.element,
                                 mainSVG = chart.container.children[0],
                                 xPos = chart.plotLeft + chart.plotWidth + 10,
                                 yPos = chart.plotTop;
    
                              mainSVG.appendChild(colorAxis);
    
                              colorAxis.setAttribute(
                                'transform','translate(' + xPos + ', ' + yPos + ')'
                              )
                             }&quot;))) %&gt;%
        hc_yAxis_multiples(
          list(title = list(text = &quot;Bed&quot;),categories=p$x$hc_opts$yAxis$categories, gridLineWidth = 0),
          list(title = list(text = &quot;Waiting Room&quot;), opposite = TRUE)) %&gt;%
        hc_add_series(waiting_census_daily,hcaes(x=x,y=y),name=&quot;waiting&quot;,color=&quot;black&quot;,yAxis=1,type=&quot;line&quot;,
                      marker = list(radius = 2, lineColor = &quot;#000&quot;, fillColor = &quot;#000&quot;))
  </code></pre>
  <p>I can attempt to create a reprex but I really just want to know, if axisParent still exists and if not, what object I may be able to use instead.</p>