I try to make a bar chart using a highcharts, it was work as it was, but there is some issue with it. When the show multiple indicators, the datalabels is hidden. Like this - datalabels provinsi aceh is hidden:
how to make it appear but not overlapping the rest of it. the max of indicators is 4.
here is my graph
Highcharts.chart(chartId, {
chart: {
type: 'column'
},
title: {
text: chartname,
align: 'center'
},
plotOptions: {
series: {
pointPadding: 0.4,
groupPadding: 0.1
}
},
tooltip: {
shared: true,
},
xAxis: {
type: 'category',
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true
}
}
},
series: grafikmaindata,
drilldown: seriessubgrafik[0],
exporting: {
buttons: {
copyToClipboard: {
text: 'Copy Chart',
_titleKey: 'contextButtonTitle',
align: 'right',
onclick: function () {
// Call the function to copy the chart to the clipboard
copyHtmlToClipboard(this.container);
},
}
}
}
});
If you want to force all dataLabels to show, enable the allowOverlap
option:
dataLabels: {
enabled: true,
allowOverlap: true
}
You can move overlaping dataLabels by updating their y
position:
chart: {
type: 'column',
events: {
load() {
let point = this.series[2].points[3];
point.update({
x: point.x,
dataLabels: {
y: 10
}
})
}
}
},
Demo: https://jsfiddle.net/BlackLabel/f2h81wbt/
API References: https://api.highcharts.com/highcharts/series.column.dataLabels.allowOverlap https://api.highcharts.com/highcharts/series.column.dataLabels.y