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: [97.9,127.6,138.3,133.9,138.9,137.7,128.2,147.2,154.7,130.7,116.8,123.8,136.4,130.7,140.2,126.9,144,155.4,137.1,137.1,140.2,128.8,144.6,131.4,135.8,142.1,126.9,142.1,66.3], 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); };