tooltip custom CSS turning the caret/arrow white - Javascript highcharts

Javascript examples for highcharts:Chart Tooltip

Description

tooltip custom CSS turning the caret/arrow white

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
      <style id="compiled-css" type="text/css">

.label {/*  ww w.  j  a  v  a2 s.c  om*/
   z-index: 1 !important;
}
.highcharts-tooltip path{
   fill:rgba(255,0,0,1);
}
.highcharts-tooltip span {
   line-height: 1;
   font-weight: normal;
   padding: 12px;
   background-color: rgba(0,0,0,0.9);
   color: white;
   border-radius: 6px;
   font-size: 16px;
   text-align: center;
   transition: opacity 0.1s;
   /*box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.85);*/
   z-index: 9999;
   max-width: 300px;
   pointer-events: none;
   word-wrap: break-word;
}
.tooltip {
   padding:5px;
}


      </style> 
      <script type="text/javascript">
$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column',
            height : 100
        },
        title: {
            text: 'Stacked column chart'
        },
        xAxis: {
            categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
            labels: {
                      enabled: true,
                      formatter: function() {
                          return "<span title='"+this.value+"'>" + this.value.toString().substring(0,3)+'...' + '</span>';
                      },
                      useHTML: true
               }
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Total fruit consumption'
            }
        },
        legend: {
            align: 'right',
            x: -30,
            verticalAlign: 'top',
            y: 25,
            floating: true,
            backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
            borderColor: '#CCC',
            borderWidth: 1,
            shadow: false,
            enabled: false
        },
        tooltip: {
            shadow: false,
            percentageDecimals: 2,
            borderRadius: 6,
            borderWidth: 0,
            padding: 0,
            formatter: function () {
                return '<b>' + this.x + '</b><br/>' +
                    this.series.name + ': ' + this.y +     '<br/>' +
                    'Total: ' + this.point.stackTotal;
            },
             useHTML: true
        },
        plotOptions: {
            column: {
                stacking: 'normal',
            }
        },
        series: [{
            name: 'John',
            data: [5, 3, 4, 7, 2]
        }, {
            name: 'Jane',
            data: [2, 2, 3, 2, 1]
        }, {
            name: 'Joe',
            data: [3, 4, 4, 2, 5]
        }]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials