[英]How can I modify a chart in ionic 2 to look like the picture below?
I am using import {Chart} from 'chart.js'; 我正在使用'chart.js'中的import {Chart}; to create my chat but I have some challenges.
创建我的聊天,但我有一些挑战。 I want to create a chart like the one shown below.
我想创建一个如下所示的图表。
Best Regards 最好的祝福
//Creating the doughth
this.doughnutChart = new Chart(this.doughnutCanvas.nativeElement, {
type: 'doughnut',
data: {
labels: ["Cash in Hand", "Cash in Bank", "Cash in Mpesa"],
datasets: [{
label: '# of Votes',
data: [this.naaam, this.naaam1, this.naaam2 ],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
hoverBackgroundColor: [
"#FF6384",
"#36A2EB",
"#FFCE56"
]
}]
}
});
We're also using Chart.js in our Ionic 2 app. 我们也在我们的Ionic 2应用程序中使用Chart.js。 For rendering the charts we use the ng2-charts library.
为了渲染图表,我们使用ng2-charts库。
With regards to your question about putting the total in the bottom center, you can just wrap your chart in a div and add an absolutely positioned span element containing the total. 关于将总数放在底部中心的问题,您可以将图表包装在div中,并添加一个包含总数的绝对定位的span元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.