remove tooltip space between border and content - Javascript highcharts

Javascript examples for highcharts:Chart Tooltip

Description

remove tooltip space between border and content

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <style id="compiled-css" type="text/css">

.label {/*from w  ww  .jav  a  2  s.  c o  m*/
   z-index: 1!important;
}
.highcharts-tooltip span {
   background-color:white;
   border:1px solid green;
   opacity:1;
   z-index:9999!important;
}
.tooltip {
   padding:5px;
}


      </style> 
      <script type="text/javascript">
$(function () {
    var chart;
    $(document).ready(function () {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'graf1',
                plotBackgroundColor: null,
                plotBorderWidth: null,
                plotShadow: false
            },
            title: {
                margin: 40,
                text: 'Pod?l v?ech pot?eb'
            },
            tooltip: {
                borderWidth: 0,
                backgroundColor: "rgba(255,255,255,0)",
                borderRadius: 0,
                shadow: false,
                useHTML: true,
                percentageDecimals: 2,
                formatter: function () {
                    return '<div class="tooltop">'+this.point.name + '<br />' + '<b>' + Highcharts.numberFormat(this.y).replace(",", " ") + ' K?? [' + Highcharts.numberFormat(this.percentage, 2) + '%]</b></div>';
                }
            },
            plotOptions: {
                pie: {
                    allowPointSelect: true,
                    cursor: 'pointer',
                    dataLabels: {
                        zIndex: 1,
                        enabled: true,
                        color: '#000000',
                        connectorWidth: 2,
                        useHTML: true,
                        formatter: function () {
                            return '<span style="color:' + this.point.color + '"><b>' + this.point.name + '</b></span>';
                        }
                    }
                }
            },
            series: [{
                type: 'pie',
                name: 'Pot?eba',
                data: [
                    ['Firefox', 45.0],
                    ['IE', 26.8], {
                        name: 'Chrome',
                        y: 12.8,
                        sliced: true,
                        selected: true
                    }, ['Safari', 8.5],
                    ['Opera', 6.2],
                    ['Others', 0.7]
                ]
            }]
        });
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="graf1" style="width: 400px; height: 250px; float:left"></div>  
   </body>
</html>

Related Tutorials