window.chartColors = { red: 'rgb(255, 99, 132)', orange: 'rgb(255, 159, 64)', yellow: 'rgb(255, 205, 86)', green: 'rgb(75, 192, 192)', blue: 'rgb(54, 162, 235)', purple: 'rgb(153, 102, 255)', grey: 'rgb(201, 203, 207)' }; var config = { type: 'line', data: { labels: ["0秒","95秒","190秒","285秒","380秒","475秒","570秒","665秒","760秒","855秒","950秒","1045秒","1140秒","1235秒","1330秒","1425秒","1520秒","1615秒","1710秒","1805秒","1900秒","1995秒","2090秒","2185秒","2280秒","2375秒","2470秒","2565秒","2660秒","2755秒"], datasets: [{ label: '瞬时速度', backgroundColor: window.chartColors.orange, borderColor: window.chartColors.orange, data: [13.3,15.8,11.4,18.9,25.3,17.7,20.8,20.2,14.5,16.4,9.5,7.6,17.7,17.7,19.6,20.2,18.3,20.8,24,19.6,18.9,29.1,22.1,24.6,19.6,15.8,15.2,16.4,8.8,0], fill: false, }] }, options: { responsive: true, title: { display: false, text: '打字速度曲线' }, tooltips: { mode: 'index', intersect: false, }, hover: { mode: 'nearest', intersect: true }, scales: { xAxes: [{ display: true, scaleLabel: { display: true, labelString: '时间' } }], yAxes: [{ display: true, scaleLabel: { display: true, labelString: '速度' } }] } } }; window.onload = function() { var ctx = document.getElementById('canvas').getContext('2d'); window.myLine = new Chart(ctx, config); };