Creating column chart and set column - Javascript highcharts

Javascript examples for highcharts:Column Chart

Description

Creating column chart and set column

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-2.1.0.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){//w  ww.j  a  v  a2s. c  o m
function create_graph(graph) {
    chart = new Highcharts.Chart ({
        chart: {
             height: 600,
             width: 1200,
             renderTo: container1,
             type: 'column'
             //reflow: false
        },
        title: {
            text: graph["graphTitle"]
        },
        xAxis: {
            categories: graph["xAxisLabels"]
        },
        yAxis: {
            min: 0,
            title: {
                text: graph["yaxisTitle"]
            }
        },
        tooltip: {
            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
            pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                '<td style="padding:0"><b>{point.y}</b></td></tr>',
            footerFormat: '</table>',
            shared: true,
            useHTML: true
        },
        plotOptions: {
            column: {
                pointPadding: 0.2,
                borderWidth: 0
            }
        },
        series: generateLineData(graph)
    });
}
xAxisLabels = ["a", "b"];
array1 = [1,2];
graph = {"graphTitle": "Title" ,"xAxisLabels" : xAxisLabels, "xAxisTitle" : "Properties", "yAxisTitle" : "Average percentile", "yAxisValues" : array1};
create_graph(graph);
function generateLineData(g) {
    return [{
            data: g["yAxisValues"]
        }]
}
    });

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container1" style="width:100%; height:400px;"></div>  
   </body>
</html>

Related Tutorials