Shared Tooltip with shared Data LABELS in Series - Javascript highcharts

Javascript examples for highcharts:Chart Tooltip

Description

Shared Tooltip with shared Data LABELS in Series

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  .ja va 2 s.  co m*/
    $('#container').highcharts({
        tooltip: {
            shared: true,
            formatter:function(){
                console.log(this.points);
                return    this.points[0].key + ' : ' + this.points[0].y + '<br/>' + this.points[1].key + ' : ' + this.points[1].y;
            }
        },
        series: [{
            name: 'Cities',
            data: [
                ["Paris", 29.9],
                ["London", 71.5],
                ["New York", 106.4]
            ]
        },
        {
            name: 'Universities',
            data: [
                ["Cambridge", 17.5],
                ["Oxford", 1.5],
                ["MIT", 16.4]
            ]
        }
        ]
    });
});

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

Related Tutorials