Basic column

author(s): Torstein Hønsi

by oysteinmoseng

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<script src="https://code.highcharts.com/themes/high-contrast-dark.js"></script>
<figure class="highcharts-figure">
    <div id="container"></div>
</figure>

CSS

body {
    background-color: #2E2B36;
}
#container {
    width: 1100px;
    height: 500px;
}

JavaScript

Highcharts.chart('container', {
	accessibility: {
    	point: {
        	descriptionFormatter: function (p) {
            	return p.category + ', ' + p.y + 'mm.';
            }
        },
        keyboardNavigation: {
        	focusBorder: {
            	style: {
                	color: 'white'
                }
            }
        }
    },
    chart: {
        type: 'column',
        backgroundColor: 'transparent'
    },
    title: {
        text: 'Tokyo Average Rainfall'
    },
    xAxis: {
        categories: [
            'Jan',
            'Feb',
            'Mar',
            'Apr',
            'May',
            'Jun',
            'Jul',
            'Aug',
            'Sep',
            'Oct',
            'Nov',
            'Dec'
        ]
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Rainfall (mm)'
        },
        gridLineColor: '#333'
    },
    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:.1f} mm</b></td></tr>',
        footerFormat: '</table>',
        shared: true,
        useHTML: true,
        backgroundColor: 'rgba(30, 30, 20, 0.95)'
    },
    plotOptions: {
        column: {
            pointPadding: 0.2,
            borderWidth: 0
        }
    },
    legend: {
    	enabled: false
    },
    credits: {
    	enabled: false
    },
    series: [{
        name: 'Tokyo',
        data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
        color: Highcharts.getOptions().colors[3],
        dataLabels: {
        	enabled: true,
            format: '{y:.1f}'
        }
    }]
});