Highcharts Demo
author(s):
Torstein Hønsi
by Kesav Telaprolu
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/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', {
chart: {
styledMode: true
},
title: {
text: 'Styling data labels by CSS'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr']
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
borderRadius: 2,
y: -10,
shape: 'connector'
}
}
},
series: [{
data: [{
y: 100,
dataLabels: {
align: 'right',
rotation: 45,
shape: null
}
}, {
y: 300
}, {
y: 500,
dataLabels: {
className: 'highlight'
}
}, {
y: 400
}]
}]
});