Highcharts Demo

author(s): Torstein Hønsi

by johnnytrinh

HTML

<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>

JavaScript

var charts = [],
    $containers = $('#container'),
    datasets = [{
        name: '2011',
        data: [3, 6, 1, 2, 6]},
    {
        name: '2012',
        data: [5, 6, 4, 2, 1]},
    {
        name: '2013',
        data: [2, 6, 5, 2, 3]},
    {
        name: '2014',
        data: [5, 2, 7, 4, 2]}];

$.each(datasets, function(i, dataset) {
    // Create the chart
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: 'Technology Brand Value'
        },
        subtitle: {
            text: 'Click the columns to view versions. Source: <a href="http://netmarketshare.com" target="_parent">netmarketshare.com</a>.'
        },
        xAxis: {
            categories: ['2011', '2012', '2013', '2014', '2015','2016']
        },
        yAxis: {
            title: {
                text: 'Total percent market share'
            }

        },
        legend: {
            enabled: false
        },
        plotOptions: {
            series: {
                borderWidth: 0,
                pointPadding: 0,
                groupPadding: 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: [datasets]
        
    }));
});