<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: "polarArea",
data: {
labels: ["教育", "交通", "醫療", "國防", "文化"],
datasets: [{
label: "預算分配",
data: [11, 16, 7, 14, 20],
backgroundColor: [
"rgba(255, 99, 132, 0.6)",
"rgba(54, 162, 235, 0.6)",
"rgba(255, 206, 86, 0.6)",
"rgba(75, 192, 192, 0.6)",
"rgba(153, 102, 255, 0.6)"
],
borderWidth: 1
}]
},
options: {
responsive: true,
scales: {
r: {
beginAtZero: true,
ticks: {
stepSize: 5
}
}
},
plugins: {
legend: {
position: "right"
}
}
}
});
</script>