HighStock Setting Flag on Click Event - Javascript highcharts

Javascript examples for highcharts:Stock Chart

Description

HighStock Setting Flag on Click Event

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Stock Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.js"></script> 
      <script type="text/javascript">
$(function() {/*from  w  ww.  jav a 2 s.c o  m*/
    var chart = new Highcharts.StockChart({
        chart: {
            renderTo: 'container'
        },
        rangeSelector: {
            selected: 1
        },
        series: [{
            name: 'USD to EUR',
            id: 'dataseries',
            data: usdeur,
            events: {
                click: function(event) {
                    this.chart.series[1].setData([{
                        x: event.point.x,
                        title: 'hey you clicked me'
                    }]);
                }
            }},
        {
            type: 'flags',
            data: [],
            onSeries: 'dataseries',
            shape: 'squarepin',
            }]
    });
});

      </script> 
   </head> 
   <body> 
      <div id="container" style="height: 400px; min-width: 600px"></div> 
      <script src="https://code.highcharts.com/stock/highstock.js"></script> 
      <script src="https://code.highcharts.com/stock/modules/exporting.js"></script> 
      <script type="text/javascript" src="https://www.highcharts.com/samples/data/usdeur.js"></script>  
   </body>
</html>

Related Tutorials