我想要制作的图表是使用 Chart.js 制作的折线图,纵轴为字符串,横轴为数字。
例如,横轴是时间,纵轴是帽子的颜色。
见下图
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],//Number of frames
datasets: [{
label: 'The colour of the hat of the person in the frame',
data: ["red","blue","red","blue","yeallow","red","blue","red","blue","yeallow",.....],
borderColor: '#f88',
}],
}
});