Plot the error bars behind the datapoints in column chart - Javascript highcharts

Javascript examples for highcharts:Column Chart

Description

Plot the error bars behind the datapoints in column chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </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/modules/exporting.js"></script> 
      <div id="container" style="height: 400px; margin: auto; min-width: 310px; max-width: 600px"></div> 
      <script type="text/javascript">
Highcharts.chart('container', {
  chart: {//  www .  jav  a 2 s . c o  m
    zoomType: 'xy'
  },
  title: {
    text: 'Temperature vs Rainfall'
  },
  xAxis: [{
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
  }],
  yAxis: [{ // Secondary yAxis
    title: {
      text: 'Rainfall',
      style: {
        color: Highcharts.getOptions().colors[0]
      }
    },
    labels: {
      format: '{value} mm',
      style: {
        color: Highcharts.getOptions().colors[0]
      }
    },
    opposite: true
  }],
  tooltip: {
    shared: true
  },
  series: [{
    name: 'Rainfall',
    type: 'column',
    zIndex: 2,
    data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
    tooltip: {
      pointFormat: '<span style="font-weight: bold; color: {series.color}">{series.name}</span>: <b>{point.y:.1f} mm</b> '
    }
  }, {
    name: 'Rainfall error',
    type: 'errorbar',
    zIndex: 1,
    data: [
      [48, 51],
      [68, 73],
      [92, 110],
      [128, 136],
      [140, 150],
      [171, 179],
      [135, 143],
      [142, 149],
      [204, 220],
      [189, 199],
      [95, 110],
      [52, 56]
    ],
    tooltip: {
      pointFormat: '(error range: {point.low}-{point.high} mm)<br/>'
    }
  }]
});

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

Related Tutorials