make specific plots of a series transparent for line chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

make specific plots of a series transparent for line 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 () {/*from  ww w  .j  a  va  2 s .  c  om*/
    $('#container').highcharts({
        chart: {
            type: 'spline'
        },
        title: {
            text: 'Monthly Average Rainfall'
        },
        subtitle: {
            text: 'Source: WorldClimate.com'
        },
        xAxis: {
            categories: [
                'Jan',
                'Feb',
                'Mar',
                'Apr',
                'May',
                'Jun'
            ],
            crosshair: true
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Rainfall (mm)'
            }
        },
        tooltip: {
            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
            pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
            footerFormat: '</table>',
            shared: true,
            useHTML: true
        },
        plotOptions: {
              series: {
            connectNulls:true},
            column: {
                pointPadding: 0.2,
                borderWidth: 0
            }
        },
        series: [{
            name: 'Tokyo',
            color: 'rgba(0,0,255, 0.4)',
            data: [49.9,0, 0, 129.2, 144.0, 176.0]
        }, {
            name: 'New York',
            data: [83.6, 78.8, 50, 0, 0, 80]
        } ]
    });
    var chart = $('#container').highcharts();
     $.each(chart.series[0].data, function(i, point){
         if(point.y == 0)
         {
             chart.series[0].data[i].update(null);
         }
     });
     $.each(chart.series[1].data, function(i, point){
         if(point.y == 0)
         {
             chart.series[1].data[i].update(null);
         }
     });
});

      </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