zIndex of dataLabel vs renderer.rect vs tooltip - Javascript highcharts

Javascript examples for highcharts:Chart Tooltip

Description

zIndex of dataLabel vs renderer.rect vs tooltip

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <style id="compiled-css" type="text/css">

.highcharts-tooltip span {
   background-color: white;
   border: 1px solid green;
   opacity: 1;
   z-index: 9999;/*from   w  w w . j  ava2s.  c o m*/
}
.tooltip {
   padding: 5px;
}


      </style> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px"></div> 
      <script type="text/javascript">
Highcharts.chart('container', {
  xAxis: {
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
  },
  tooltip: {
    useHTML: true,
    formatter: function() {
      return '<div class="tooltip">value: ' + this.y + '</div>';
    },
    outside: true
  },
  plotOptions: {
    series: {
      dataLabels: {
        enabled: true,
        useHTML: true 
      }
    }
  },
  series: [{
    data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
  }]
}, function(chart) { // on complete
  chart.renderer.rect(100, 100, 100, 100, 5)
    .attr({
      'stroke-width': 2,
      stroke: 'red',
      fill: 'yellow'
    })
    .add()
    .toFront();
});

      </script>  
   </body>
</html>

Related Tutorials