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: [30.9,36,27.2,39.8,35.4,32.2,29.1,26.5,32.8,43.6,27.2,31.6,37.3,29.7,28.4,33.5,20.8,27.2,34.1,32.2,28.4,31.6,42.3,34.7,32.2,36.6,42.9,24.6,20.2,31.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); };