connect Nulls with dotted line in line chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

connect Nulls with dotted line in line chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Connect nulls with different series style</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function() {/*from  www .j  a  va2  s.co  m*/
  $('#container').highcharts({
    title: {
      text: 'LineWithNulls'
    },
    subtitle: {
      text: 'connect the the line in a different color or with a dotted line'
    },
    xAxis: {
      categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },
    series: [{
      data: [4, 5, 1, {
        y: null,
        color: 'red'
      }, 3, 4, 2, null, 5, 6],
      connectNulls: false,
      zIndex: 2
    }, {
      /* differently formatted series for "null" values in first series
      prevent from showing up in legend and prevent series from showing in tooltip on mouse over */
      data: [null, null, 1, 2, 3, null, 2, 3.5, 5, null],
      connectNulls: false,
      color: 'red',
      marker: {
        enabled: false
      },
      dashStyle: 'dash',
      zIndex: 1,
      showInLegend: false,
      enableMouseTracking: false
    }]
  });
});

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

Related Tutorials