运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script> <body> <canvas id="myChart" style="width:100%;max-width:600px"></canvas> <script> const xValues = [50,60,70,80,90,100,110,120,130,140,150]; const yValues = [7,8,8,9,9,9,10,11,14,14,15]; new Chart("myChart", { type: "line", data: { labels: xValues, datasets: [{ fill: false, lineTension: 0, backgroundColor: "rgba(0,0,255,1)", borderColor: "rgba(0,0,0,0)", data: yValues }] }, options: { legend: {display: false}, scales: { yAxes: [{ticks: {min: 6, max:16}}], } } }); </script> </body> </html>