Reputation: 798
I am using Highchart pyramid in angular, Now its labels are showing in the right side of the below attached image. As i want to show series dataLabels inside the Highchart pyramid, i attached the below code i am using to retrieve Highchart pyramid .
How can I solve this?
public loadSevirtychart(data): any {
const that = this;
that.chartOptions2 = {
chart: {
type: "pyramid",
},
title: {
text: "",
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
format: "({point.x:,.0f})",
allowOverlap: false,
connectorPadding: 0,
distance: 10,
softConnector: true,
x: 0,
connectorShape: "fixedOffset",
crookDistance: "70%"
},
showInLegend: true,
cursor: "pointer",
point: {
events: {
click(event) {
that.drilldownseveritychart(this.id, this.name);
},
},
},
},
},
tooltip: {
formatter() {
const val = this.point.x;
return "<b>" + this.point.name + "</b>: " + val + "";
},
},
credits: {
enabled: false,
},
legend: {
layout: "horizontal",
verticalAlign: "bottom",
align: "center",
itemWidth: 85,
symbolWidth: 8,
symbolHight: 6,
floating: false,
borderWidth: 0,
backgroundColor: "#FFFFFF",
shadow: false,
itemStyle: {
font: "8pt Trebuchet MS, Verdana, sans-serif",
color: "#A0A0A0",
},
},
series: [{
name: "Count",
data,
}],
};
}
Upvotes: 0
Views: 543
Reputation: 7372
You can set dataLabels.inside = true
(Highcharts version 7.1.2 and higher):
plotOptions: {
series: {
dataLabels: {
enabled: true,
inside: true,
align: "center",
verticalAlign: "middle"
}
}
}
Demo:
API reference:
https://api.highcharts.com/class-reference/Highcharts.SeriesPieDataLabelsOptionsObject#inside
https://api.highcharts.com/class-reference/Highcharts.SeriesPieDataLabelsOptionsObject#align
https://api.highcharts.com/class-reference/Highcharts.SeriesPieDataLabelsOptionsObject#verticalAlign
Upvotes: 1