Format tooltip numbers - Javascript highcharts

Javascript examples for highcharts:Chart Tooltip

Description

Format tooltip numbers

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> 
      <script type="text/javascript">
$(function () {/*from w w w .  j av  a 2s.  com*/
    Highcharts.setOptions({
        global: {
            useUTC: false,
        },
        lang: {
            decimalPoint: ',',
            thousandsSep: '.'
        }
    });
    $('#container').highcharts({
        xAxis: {
            type: 'datetime'
        },
        tooltip: {
            formatter:function(){
                return this.point.series.name + ': <b>' + Highcharts.numberFormat(this.point.options.count,1,',','.') + '</b><br/>' + 'Count: <b>'+Highcharts.numberFormat(this.point.y,1,',','.')+'</b><br/>';
            }
        },
        series: [{
            data: [{
                y: 20009.9,
                count: 20009.9
            }, {
                y: 10009.9,
                count: 20009.9
            }, {
                y: 40009.9,
                count: 20009.9
            }],
            pointStart: Date.UTC(2010, 0, 1),
            pointInterval: 3600 * 1000 // one hour
        }]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px"></div>  
   </body>
</html>

Related Tutorials