Hide Plot Line on Drill down Event - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

Hide Plot Line on Drill down Event

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/data.js"></script> 
      <script src="https://code.highcharts.com/modules/drilldown.js"></script> 
      <div id="container"></div> 
      <script type="text/javascript">
var plotLine = {//  w w  w. j  a  v a 2 s . c o  m
  id: 'y-axis-plot-line-0',
  color: '#FF0000',
  width: 1,
  value: 30
};
Highcharts.chart('container', {
  chart: {
    type: 'column',
    events: {
      drilldown: function() {
        this.yAxis[0].removePlotLine('y-axis-plot-line-0');
      },
      drillup: function() {
        this.yAxis[0].addPlotLine(plotLine);
      }
    }
  },
  yAxis: {
    plotLines: [plotLine]
  },
  series: [{
    colorByPoint: true,
    data: [{
      name: 'First',
      drilldown: 'First',
      y: 75
    }, {
      name: 'Second',
      drilldown: 'Second',
      y: 25
    }]
  }],
  drilldown: {
    series: [{
      type: 'line',
      name: 'First',
      id: 'First',
      data: [10, 20, 30, 40, 50]
    }, {
      type: 'line',
      name: 'Second',
      id: 'Second',
      data: [50, 40, 30, 20, 10]
    }]
  }
});

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

Related Tutorials