Javascript examples for highcharts:Column Chart
generate array series for column chart
<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 www . ja va 2 s . co m var series = []; var fields = [32, 22]; for (var i=0; i<fields.length; i++) { var field_result = new Object(); var result_array = []; field_result.name = fields[i]; for (var m=0; m<4; m ++){ result_array[m] = Math.random()*10; } field_result.data = result_array; series.push(field_result); } $('#container').highcharts({ chart: { type: 'column' }, title: { text: 'Column chart with negative values' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] }, credits: { enabled: false }, series: series }); }); </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>