<script src="https://www3.nhu.edu.tw/js/public/chart.js"></script>
<style>
#myChart {
width:600px;
margin: 20px auto;
}
@media screen and (max-width: 736px) {
#myChart {
width:400px;
height:600px !important;
}
}
</style>
<canvas id="myChart" ></canvas>
<script>
const ctx = document.getElementById("myChart");
new Chart(ctx, {
type: "radar",
data: {
labels: ["速度", "力量", "耐力", "技巧", "團隊合作", "智力"],
datasets: [
{
label: "學生 A",
data: [80, 90, 70, 85, 60, 75],
backgroundColor: "rgba(54, 162, 235, 0.2)",
borderColor: "rgba(54, 162, 235, 1)",
pointBackgroundColor: "rgba(54, 162, 235, 1)"
},
{
label: "學生 B",
data: [60, 75, 85, 70, 80, 65],
backgroundColor: "rgba(255, 99, 132, 0.2)",
borderColor: "rgba(255, 99, 132, 1)",
pointBackgroundColor: "rgba(255, 99, 132, 1)"
}
]
},
options: {
responsive: true,
scales: {
r: {
beginAtZero: true,
min: 0,
max: 100,
ticks: {
stepSize: 20
}
}
},
plugins: {
legend: {
position: "top"
}
}
}
});
</script>