0
如何使用Chart.js和Angular2在甜甜圈图表中添加文本标签? 我看到了这个主题的一些答案,但他们都没有为我工作,因为我正在使用Ionic2应用程序。 这是我的简化代码:使用Chart.js和Angular2,Ionic2的甜甜圈图表中的文本
import { Chart } from 'chart.js';
@ViewChild('doughnutCanvas') doughnutCanvas;
ionViewDidEnter() {
this.doughnutChart = new Chart(this.doughnutCanvas.nativeElement, {
type: 'doughnut',
data: {
labels: this.titles,
datasets: [{
label: '# of Work',
data: this.times,
backgroundColor: [
'rgba(255, 99, 132, 0.5)',
'rgba(54, 162, 235, 0.5)'
],
hoverBackgroundColor: [
"#FF6384",
"#36A2EB"
]
}]
},
options: {
responsive: true,
legend: {
display: false
}
}
});
}
以及如何使其响应变化? –
@ ChrisK.um ..有什么变化?图表大小? –
我想要显示图表数据的总和,因此如果数据发生更改,我希望文本显示新的总和。 –