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秒","70秒","140秒","210秒","280秒","350秒","420秒","490秒","560秒","630秒","700秒","770秒","840秒","910秒","980秒","1050秒","1120秒","1190秒","1260秒","1330秒","1400秒","1470秒","1540秒","1610秒","1680秒","1750秒","1820秒","1890秒","1960秒","2030秒"], datasets: [{ label: '瞬时速度', backgroundColor: window.chartColors.orange, borderColor: window.chartColors.orange, data: [41.1,41.1,73.7,76.3,63.4,80.6,58.3,67.7,90.9,10.3,89.1,58.3,66.9,62.6,83.1,64.3,67.7,63.4,78,52.3,50.6,74.6,80.6,41.1,65.1,46.3,57.4,36.9,43.7,37.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); };