A Pen by MaximizedOwl on CodePen.
Created
June 22, 2021 15:27
-
-
Save MaximizedOwl/0c1b582dab62742d6caf1c9f0be4c9ec to your computer and use it in GitHub Desktop.
chatjs-doughnut-sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='content'> | |
<canvas id="myChart" width="50" height="50"></canvas> | |
<h1 class='title'>タイトル</h1> | |
</div> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.3.2/chart.min.js" integrity="sha512-VCHVc5miKoln972iJPvkQrUYYq7XpxXzvqNfiul1H4aZDwGBGC0lq373KNleaB2LpnC2a/iNfE5zoRYmB4TRDQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> | |
<script> | |
const ctx = document.getElementById("myChart"); | |
const myChart = new Chart(ctx, { | |
type: 'doughnut', | |
data: { | |
labels: ["〜90", "90〜100", "100〜110", "110〜"], | |
datasets: [{ | |
backgroundColor: [ | |
"pink", | |
"orange", | |
"yellow", | |
"yellowgreen" | |
], | |
data: [20, 30, 35, 15] | |
}] | |
}, | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getElementsByTagName("h1")[0].style.fontSize = "6vw"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family: system-ui; | |
background: #fff; | |
color: #0f0f0f; | |
text-align: center; | |
} | |
.content { | |
position: relative; | |
} | |
.title { | |
position: absolute; | |
top: 40%; | |
left: 38%; | |
z-index: 10; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment