make plotline appear on line chart when data is same ? - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

make plotline appear on line chart when data is same ?

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() {/*from w  ww  . ja va2  s.c o m*/
  $('#container').highcharts({
    title: {
      text: 'Monthly Average Temperature',
      x: -20 //center
    },
    subtitle: {
      text: 'Source: WorldClimate.com',
      x: -20
    },
    xAxis: {
      categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
      ]
    },
    yAxis: {
      title: {
        text: 'Temperature (?C)'
      },
      plotLines: [{
        value: 10,
        color: '#ff0000',
        width: 2,
        zIndex: 4,
        label: {
          text: 'goal'
        }
      }]
    },
    tooltip: {
      valueSuffix: '?C'
    },
    legend: {
      layout: 'vertical',
      align: 'right',
      verticalAlign: 'middle',
      borderWidth: 0
    },
    series: [{
      name: 'Tokyo',
      data: [7.0, 7.0, 7.0, 7.0]
    }]
  }, function(chart) {
    chart.addSeries({
      showInLegend: false,
      enableMouseTracking: false,
      data: [10],
      marker: {
        enabled: false
      }
    })
  });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials