draw Confidence Intervals in line chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

draw Confidence Intervals in 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-git.js"></script> 
      <script type="text/javascript">
$(function() {// w  w w . j a v a2  s .  c o m
    window.chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container',
            inverted: false
        },
        title: {
            text: 'Confidence intervals'
        },
        xAxis: {
            categories: ['Item #1', 'Item #2']
        },
        yAxis: [{
            title: {
                text: 'Value'
            },
            gridZIndex: -1,
            plotLines: [{  value: 0,
                           color: 'red',
                           width: 1
            }]
        }],
        plotOptions: {
            columnrange: {
                grouping: false,
                color: 'navy'
            },
            scatter: {
                color: 'navy',
                marker: {
                    symbol: 'diamond'
                }
            }
        },
        tooltip: {
            shared: true
        },
        legend: {
            enabled: false
        },
        series: [{
            type: 'columnrange',
            pointWidth: 2,
            data: [
                [-0.54, 0.40],
                [-0.34, 0.30]
            ]
        }, {
            type: 'columnrange',
            pointWidth: 15,
            minPointLength: 2,
            data: [
                [-0.54, -0.54],
                [-0.34, -0.34]
            ]
        }, {
            type: 'columnrange',
            pointWidth: 15,
            minPointLength: 2,
            data: [
                [0.40, 0.40],
                [0.30, 0.30]
            ]
        }, {
            type: 'scatter',
            data: [
                [-0.07],
                [-0.02]
            ]
        }]
    });
});

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

Related Tutorials