Javascript examples for highcharts:Column Chart
fill data dynamically in column chart
<html> <head> <title>Highcharts Demo</title> <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 () {/* w w w . j av a 2 s. c om*/ // Create the chart var productsName = ['Laptop', 'Photoframe', 'PuzzleBox'], productPrintCount = [56,24,10], mappingDataFn = function () { var resultData = []; $.each(productsName, function (key, value) { resultData.push({ 'name': value, 'y': productPrintCount[key] }); }); return resultData; }; $('#container').highcharts({ chart: { type: 'column' }, title: { text: 'Product' }, subtitle: { text: '' }, xAxis: { type: 'category' }, yAxis: { title: { text: 'Total percent market share' } }, legend: { enabled: false }, plotOptions: { series: { borderWidth: 0, dataLabels: { enabled: true, format: '{point.y:.1f}%' } } }, tooltip: { headerFormat: '<span style="font-size:11px">{series.name}</span><br>', pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>' }, series: [{ name: 'Brands', colorByPoint: true, data: mappingDataFn() }] }); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/data.js"></script> <script src="https://code.highcharts.com/modules/drilldown.js"></script> <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> </body> </html>