0

I would like to know how can I write some information in the center of my doughnut chart. Here is my code:

ngOnInit(): void {
// pie chart:
this.PieChart = new Chart('pieChart', {
  type: 'doughnut',
  data: {
    labels: ["Individuel 60%", "Collectif 40%"],
    datasets: [{
      label: '# of Votes',
      data: [40, 60],
      backgroundColor: [
        'rgba(255, 159, 64, 0.2)',
        'rgba(153, 102, 255, 0.2)'
      ],
      borderColor: [
        'rgba(255, 159, 64, 1)',
        'rgba(153, 102, 255, 1)'
      ],
      borderWidth: 1
    }]
  },
  options: {
    title:{
      text:"",
      display:true,

    },

  }
});

} Someone have an idea?

Syllaba Abou Ndiaye
  • 213
  • 1
  • 7
  • 21
  • This has been discussed here: https://stackoverflow.com/questions/20966817/how-to-add-text-inside-the-doughnut-chart-using-chart-js – uminder Apr 01 '19 at 15:42
  • it's not the same. In angular the function fillText() did not exist – Syllaba Abou Ndiaye Apr 01 '19 at 16:13
  • https://stackoverflow.com/questions/55459077/how-can-i-add-some-text-in-the-middle-of-a-half-doughnut-chart-in-chart-js See if it matches with your question too. – Adnan Sharif Apr 02 '19 at 20:11

0 Answers0