Create bar chart, data from array - Javascript highcharts

Javascript examples for highcharts:Bar Chart

Description

Create bar chart, data from array

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</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 w ww  .ja v  a2 s  .c  om*/
  var data = [1, 2, 3, 4, 5, 6, 7, 8, 9];
  Highcharts.each(data, function(point, i) {
    data[i] = [point, '#f' + point + '0'];
  });
  $('#container').highcharts({
    series: [{
      type: 'bar',
      data: data,
      keys: ['y', 'color']
    }]
  });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px"></div> 
      <button id="button">xData</button> 
      <button id="button2">Add point</button>  
   </body>
</html>

Related Tutorials