我使用的是角度6,我有一个垂直的条形图。我想让酒吧的角落变得圆圆!我该怎么做呢?
下面是代码的一部分:
.ts
ngAfterViewInit() {
this.canvas = document.getElementById('barChart');
this.ctx = this.canvas.getContext('2d');
let myChart = new Chart(this.ctx, {
type: 'bar',
data: {
labels: this.my_labels,
datasets: [
{
label: '',
fill: false,
backgroundColor: [
'#2699fb',
'#2699fb',
'#2699fb',
],
borderWidth: 1,
data: [12000, 18000, 65000],
}
]
},
options: {
responsive: false,
legend: {
display: false
}
}
});
}发布于 2019-11-13 10:53:35
您可以安装chartjs-top-round-bar.通过以下步骤:-
1. Install the plugin - npm i chartjs-top-round-bar.
2. Import in TS - import 'chartjs-top-round-bar';.
3. Add in the option while creating Chart -
let myChart = new Chart(this.ctx, {
type: 'roundedBar',
data: {
labels: ['label 1'],
datasets: [{label: 'Label 1', data}]
},
options: {
barRoundness: 0.3
}
}我希望这能帮到你。
https://stackoverflow.com/questions/52233915
复制相似问题