我想用Angular和Chart.js在我的网站上绘制折线图。 我想做的特别的事情是沿着x轴滑动整个图形。
(例如:x轴= 13:00,14:00,15:00,...,然后我将悬停并用鼠标左键推动以将图表移至:15:00 ,16:00,17:00) 整个“时间”值正确的数组已经在数据中 (我只会移动扇区)
drawChart() {
this.chart = new Chart('canvas', {
type: 'line',
data: {
labels: this.EnergyTimeArray,
datasets: [
{
label: 'ABCDE',
data: this.actArray,
borderColor: '#7cb342',
fill: '1'
},
{
label: 'FGHIJK',
data: this.testArray,
borderColor: 'orange',
fill: '-1'
}
]
},
options: {
legend: {
display: true
},
scales: {
xAxes: [{
scaleLabel: {
display: true,
labelString: 'Uhrzeit'
}
}],
yAxes: [{
scaleLabel: {
display: true,
labelString: 'YAxis'
}
}],
}
}
});
....现在我将移动图形,以便可以从23:00,24:00,..
您对我有什么解决办法吗?我在文档中找不到任何内容。
感谢罗宾