display tooltip data in line chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

display tooltip data in line chart

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> 
      <script type="text/javascript">
$(function () {/*from w  w  w .  ja va  2s. co  m*/
    var priceHistoryObjArray = [{
        x: 1379883600000,
        y: 47.19,
        name: 'extra data'
    }, {
        x: 1379970000000,
        y: 48.45,
        name: 'extra data 2'
    }, {
        x: 1380056400000,
        y: 49.46,
        name: 'extra data 3'
    }, {
        x: 1380142800000,
        y: 50.39,
        name: 'extra data 4'
    }];
    $('#container').highcharts({
        tooltip: {
            formatter: function () {
                return this.x + " " + this.point.name;
            }
        },
        series: [{
            name: 'Price',
            data: priceHistoryObjArray,
            id: 'dataseries'
        }]
    });
});

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

Related Tutorials