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秒"], datasets: [{ label: '瞬时速度', backgroundColor: window.chartColors.orange, borderColor: window.chartColors.orange, data: [27.8,37.3,30.3,32.8,30.9,29.1,4.4,8.2,20.8,13.3,27.2,20.8,6.3,23.4,14.5,15.2,19.6,27.8,19.6,17.7,35.4,24,18.3,30.3,23.4,29.1,30.3,26.5,29.7], 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); };