I am currently utilizing apex chart within an angular application to showcase charts. I am specifically focusing on a pie chart and aiming to customize it by displaying labels on the values within each slice of the pie, similar to what is shown in the attached image. Unfortunately, I have not been able to find a solution for this yet. Any guidance or direction would be greatly appreciated. Thank you.
screenshot [1]: https://i.stack.imgur.com/vMcHk.png
import { ChartComponent, ApexLegend, ApexDataLabels, ApexFill, ApexPlotOptions, ApexNonAxisChartSeries, ApexResponsive, ApexChart } from 'ng-apexcharts';
export interface ChartOptions {
series: ApexNonAxisChartSeries;
chart: ApexChart;
responsive: ApexResponsive[];
labels: any[];
legend: ApexLegend;
dataLabels: ApexDataLabels;
fill: ApexFill;
plotOptions: ApexPlotOptions;
}
export class PieChartComponent implements OnInit {
@ViewChild('chart') chart: ChartComponent;
public chartOptions: Partial<ChartOptions>;
constructor() {}
ngOnInit(): void {
this.chartOptions = {
series: [70.48, 29.52],
chart: {
width: 380,
type: 'pie',
toolbar: {
tools: {
download: false,
},
},
},
legend: {
show: false,
},
labels: ['DII', 'FII'],
fill: {
colors: ['#ffe163', '#694fb6'],
},
plotOptions: {
pie: {
startAngle: 110,
},
},
dataLabels: {
style: {
fontSize: '14',
fontWeight: '600',
colors: ['#000000', '#ffffff'],
},
},
responsive: [
{
breakpoint: 480,
options: {
chart: {
width: 400,
},
legend: {
position: 'bottom',
},
},
},
],
};
}
}
<apx-chart
[series]="chartOptions.series"
[chart]="chartOptions.chart"
[labels]="chartOptions.labels"
[responsive]="chartOptions.responsive"
[legend]="chartOptions.legend"
[dataLabels]="chartOptions.dataLabels"
[fill]="chartOptions.fill"
[plotOptions]="chartOptions.plotOptions"
></apx-chart>