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.2,26.5,29.7,33.5,27.2,30.3,36.6,25.9,21.5,36.6,36,35.4,34.7,25.9,32.8,22.1,22.7,13.3,29.1,35.4,24.6,23.4,15.2,16.4,21.5,28.4,31.6,23.4,7.6], 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); };