我使用角度为 6 的 c3.js 创建了一个条形图。如果值更多,我想添加一个滚动条。
我的代码如下:
HTML
<canvas id="myChart1" width="700" height="400"></canvas>
打字稿
this.canvas1 = document.getElementById('myChart1');
this.ctx1 = this.canvas1.getContext('2d');
let myChart1 = new Chart(this.ctx1, {
type: 'bar',
data: {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: '',
backgroundColor: '#920909',
borderColor: '#1E88E5',
data: [63, 58, 82, 81, 56, 55, 41]
},
{
label: '',
backgroundColor: '#04033b',
borderColor: '#7CB342',
data: [27, 49, 45, 19, 87, 28, 90]
},
{
label: '',
backgroundColor: '#0c6790',
borderColor: '#7CB342',
data: [2, 50, 40, 29, 80, 27, 40]
},
]
},
options: {
responsive: false,
display:true,
scales: {
yAxes:[{
ticks:{
beginAtZero:true
}
}]
}
}
});
我使用角度为 6 的 c3.js 创建了一个条形图。如果值更多,我想添加一个滚动条。