0👍
I found the solution.
Chart.js doesn’t support labels inside of the chart. So instead, I’m using Highcharts.
-
Install the highchart. You can have both libraries in the Chartkick installation.
yarn add highchart
-
Then you add the following into the application.js file.
import "chartkick/highcharts"
-
Then in the view for the pie chart, you append this.
= pie_chart @data, donut: true, library: { pieSliceText: ‘value-and-percentage’, plotOptions: {pie: {dataLabels: {enabled: true,format: ‘{point.name}:
{point.percentage:.1f} %’,}}}}
- Chartjs-ChartJs – annotation line can not drawn
- Chartjs-How do I run Chart.js with Angular 10 SSR / universal?
Source:stackexchange.com