flags onSeries for stock chart - Javascript highcharts

Javascript examples for highcharts:Chart Series

Description

flags onSeries for stock 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 () {//  ww  w.  j  ava 2  s . c  o  m
    $('#container').highcharts('StockChart', {
        chart: {
          height: 1800
        },
        title : {
            text : 'AAPL Stock Price'
        },
        yAxis: [
            {
              labels: {},
              title: {
                text: 'test1'
              },
              height: 100,
              opposite: false,
              offset: 0
            },
            {
              labels: {},
              title: {
                text: 'test2'
              },
              height: 100,
              top: 300,
              opposite: false,
              offset: 0
            }
        ],
        series : [{
                name : 'AAPL',
                data : [[1241136000000,18.18],[1243555200000,19.40],[1246320000000,20.35]],
                id: 'test1',
                tooltip: {
                    valueDecimals: 2
                }
                ,
                yAxis: 0
            },
            {
                name : 'AAPL',
                data : [[1241136000000,18.18],[1243555200000,19.40],[1246320000000,20.35]],
                id: 'test2',
                tooltip: {
                    valueDecimals: 2
                },
                yAxis: 1
            },
            {
              type: 'flags',
              data: [{x: 1241136000000, title: "TEST1" }],
              onSeries: 'test1',
              shape: 'squarepin',
              width: 16,
              fillColor: 'red',
              yAxis: 0
            },
            {
              type: 'flags',
              data: [{x: 1243555200000, title: "TEST2" }],
              onSeries: 'test2',
              shape: 'squarepin',
              width: 16,
              fillColor: 'lightgreen',
              yAxis: 1
            }
        ]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/stock/highstock.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