I am following the Blazor Bootstrap demo for creating a Pie Chart: https://docs.blazorbootstrap.com/data-visualization/pie-chart
I can successfully make regular pie charts, however, I am unable to add DataLabels to each slice in the chart. I have included the following lines:
await pieChart.InitializeAsync(chartData: chartData, chartOptions: pieChartOptions, plugins: new string[] { "ChartDataLabels" });
...and
dataset1.Datalabels.Anchor = "end";
...to add the datalabels (as indicated in the tutorial) but I am running into the error: Microsoft.JSInterop.JSException: ChartDataLabels is not defined
I have followed the Bootstrap tutorials to a tee and have tried directly copying and pasting the code from the demo with no success.
If anyone knows how to add datalabels to Blazor Bootstrap Pie Charts, any help would be much appreciated!
Thanks.
This is likely a bit late, but you can set your labels direclty in the ChartData object.
For example :