Highcharts Demo

author(s): Torstein Hønsi

by Bilal Shakeel

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>

<div id="container"></div>

CSS

#container {
	min-width: 310px;
	max-width: 800px;
	height: 400px;
	margin: 0 auto
}

JavaScript

Highcharts.chart('container', {

    title: {
        text: 'Solar Employment Growth by Sector, 2010-2016'
    },

    subtitle: {
        text: 'Source: thesolarfoundation.com'
    },

    yAxis: {
        title: {
            text: 'Number of Employees'
        }
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'middle'
    },

    plotOptions: {
        series: {
            label: {
                /* connectorAllowed: false */
            },
            /* pointStart: 2010 */
        }
    },
    tooltip: {
      formatter: function () {
        return 'z: '+ this.point.z +
          '<br/>more: '+ this.point.more +
          '<br/>even more: '+ this.point.emore;
      }
    },
    series: [{
        name: 'Installation',
        data: [{
                y: 24916,
                x: 1,
                z: 100,
                more: 1,
                emore: 2
            },{
                y: 24064,
                x: 2,
                z: 100,
                more: 1,
                emore: 2
            },{
                y: 26916,
                x: 3,
                z: 100,
                more: 1,
                emore: 2
            }]
    },{
        name: 'Deployment',
        data: [{
                y: 31916,
                x: 2,
                z: 100,
                more: 1,
                emore: 2
            },{
                y: 32064,
                x: 3,
                z: 100,
                more: 1,
                emore: 2
            }]
    }],

    responsive: {
        rules: [{
            condition: {
                maxWidth: 500
            },
            chartOptions: {
                legend: {
                    layout: 'horizontal',
                    align: 'center',
                    verticalAlign: 'bottom'
                }
            }
        }]
    }

});