I am Beginner in Ionic 2. I am using Chart.js Library to show pie chart in Hybrid mobile Application.
I have successfully show data in pie chart but its show numbers, I want to show percentage instead of numbers.
Note: my data is Dynamic stored in array. so, i am passing array data1 and data2 for dataset and lables.
This is my code
this.doughnutChart = new Chart(this.doughnutCanvas.nativeElement, {
type: 'doughnut',
data: {
labels: data1, //data1 contains [100 ,50 ,200 ,500 ,60]
datasets: [{
label: '# of Votes',
data: data2, //data2 contains [Gerberea,Lili,Rose,Sunflower,Lotus]
backgroundColor: [
'rgba(0, 99, 132, 0.2)',
'rgba(25, 162, 235, 0.2)',
'rgba(50, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(100, 102, 255, 0.2)',
'rgba(125, 159, 64, 0.2)'
],
hoverBackgroundColor: [
"#FF6384",
"#36A2EB",
"#FFCE56",
"#FF6384",
"#36A2EB",
"#FFCE56"
]
}]
}
});
I just need percentage representation instead of values. please suggest the solution. Thank you in advance.