add hyperlinks to line charts? - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

add hyperlinks to line charts?

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>external links</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.1.js"></script> 
      <script type="text/javascript">
    $(function(){//from   ww w  .j  a v a  2 s .  c  om
var data = [{y:5,q:12},
            {y:6,q:75},
            {y:8,q:456},
            {y:3,q:9},
            {y:4,q:72},
            {y:2,q:688}];
var options = {
    chart: {
        type:'line',
        style: {
            fontFamily: 'Geneva, Tahoma, Verdana, sans-serif'
        }
    },
    title: {
        text: 'Chart Test Example',
        style: {
            fontSize:'1em',
            fontWeight:'bold'
        }
    },
    legend: { },
    tooltip: {
        shared: true,
        crossHairs: true,
        useHTML: true
    },
    plotOptions: {
        series: {
            cursor:'pointer',
            point:{
               events:{
                  click:function() {
                            var href = 'http://www.google.com?q=' + this.options.q;
                     window.open(href);
                  }
               }
            }
         }
      },
    xAxis: {
        //categories: categories,
        lineColor:'#000',
        lineWidth:.5,
        tickWidth:.5,
        tickLength:3,
        tickColor:'#000',
        title: {
            text: 'X Axis',
            style: {
                color:'#000',
                fontSize:'.8em'
            }
        }
    },
    yAxis: {
        lineColor:'#000',
        lineWidth:.5,
        tickWidth:.5,
        tickLength:3,
        tickColor:'#000',
        gridLineWidth:.5,
        gridLineColor:'#eee',
        title: {
            text: 'Y Axis',
            rotation:0,
            style: {
                color:'#000',
                fontSize:'.8em'
            }
        }
    },
    series:[]
};
$('#container').highcharts(options);
var chart = $('#container').highcharts();
chart.addSeries({ name:'Series A', data:data });
    });

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/highcharts-more.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="height:400px;margin:1.5em 1em;"></div>  
   </body>
</html>

Related Tutorials