Highcharts Demo

author(s): Torstein Hønsi

by J. Albert Bowden

HTML

<script src="https://code.highcharts.com/js/highcharts.js"></script>
<script src="https://code.highcharts.com/js/modules/exporting.js"></script>

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

CSS

@import 'https://code.highcharts.com/css/highcharts.css';

#container {
	height: 400px;
	min-width: 300px;
	max-width: 800px;
	margin: 0 auto;
}
.highcharts-data-label-box {
	fill: #a4edba;
	stroke: gray;
	stroke-width: 1px;
}
.highcharts-data-label {
	font-weight: normal;
}
.highlight .highcharts-data-label-box {
	fill: red;
	stroke-width: 2px;
	stroke: black;
}
.highlight.highcharts-data-label text {
	font-weight: bold;
	fill: white;
}

JavaScript

Highcharts.chart('container', {

    title: {
        text: 'Styling data labels by CSS'
    },

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr']
    },

    plotOptions: {
        series: {
            dataLabels: {
                enabled: true,
                borderRadius: 2,
                y: -10,
                shape: 'callout'
            }
        }
    },

    series: [{
        data: [100, 300, {
            y: 500,
            dataLabels: {
                className: 'highlight'
            }
        }, 400]
    }]

});