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秒","105秒","210秒","315秒","420秒","525秒","630秒","735秒","840秒","945秒","1050秒","1155秒","1260秒","1365秒","1470秒","1575秒","1680秒","1785秒","1890秒","1995秒","2100秒","2205秒","2310秒","2415秒","2520秒","2625秒","2730秒","2835秒","2940秒"], datasets: [{ label: '瞬时速度', backgroundColor: window.chartColors.orange, borderColor: window.chartColors.orange, data: [85.7,109.1,87.4,118.9,108.6,105.1,115.4,106.3,110.9,121.1,111.4,96.6,101.1,103.4,122.3,113.1,103.4,73.1,78.9,68.6,91.4,90.9,105.1,117.1,97.1,90.3,114.9,100.6,52.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); };