Flag series tooltip to follow yAxis - Javascript highcharts

Javascript examples for highcharts:Chart Tooltip

Description

Flag series tooltip to follow yAxis

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"> 
   </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> 
      <script type="text/javascript">
Highcharts.stockChart('container', {
  chart: {/*  w ww  .j a  va2  s. c  o m*/
     height: 600,
  },
 navigator: {
        enabled: false
    },
    yAxis: [{
    id: "1",
    height: 200,
    },{
    id: "2",
    top: 300,
    height: 200,
    }],
    tooltip:{
      shared: false
    },
    series: [{
        name: 'USD to EUR',
        id: 'dataseries',
        data: usdeur,
        yAxis: "1"
    },{
        name: 'USD to EUR1',
        id: 's1',
        data: usdeur,
        yAxis:"2"
    }, {
        type: 'flags',
        data: [{
            x: Date.UTC(2011, 1, 14),
            title: 'A',
            text: 'Shape: "squarepin"'
        }, {
            x: Date.UTC(2011, 3, 28),
            title: 'A',
            text: 'Shape: "squarepin"'
        }],
        onSeries: 'dataseries',
        shape: 'squarepin',
        width: 16
    }, {
        type: 'flags',
        data: [{
            x: Date.UTC(2010, 2, 1),
            text: 'Shape: "circlepin"'
        }, {
            x: Date.UTC(2010, 9, 1),
            text: 'Shape: "circlepin"'
        }],
        shape: 'circlepin',
        onSeries: 's1',
        yAxis:"2",
        title: 'B',
        tooltip: {
           followPointer: true,
        },
        width: 16
    }, {
        type: 'flags',
        data: [{
            x: Date.UTC(2012, 2, 10),
            title: 'C',
            text: 'Shape: "flag"'
        }, {
            x: Date.UTC(2013, 3, 11),
            title: 'C',
            text: 'Shape: "flag"'
        }],
        yAxis:"2",
        color: '#5F86B3',
        fillColor: '#5F86B3',
        onSeries: 's1',
        width: 16,
        style: { // text style
            color: 'white'
        },
        states: {
            hover: {
                fillColor: '#395C84' // darker
            }
        }
    }]
});

      </script>  
   </body>
</html>

Related Tutorials