Skip to content

Instantly share code, notes, and snippets.

@marorika
Last active April 4, 2018 16:03
Show Gist options
  • Save marorika/e5f9f606b91f8562ec7d8cc6f4e476cb to your computer and use it in GitHub Desktop.
Save marorika/e5f9f606b91f8562ec7d8cc6f4e476cb to your computer and use it in GitHub Desktop.
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script>
<canvas id="myDoughnut" style="width: 100%; height: 300px;"></canvas>
<script>
var myDoughnutElement = document.getElementById("myDoughnut");
var myDoughnut = new Chart(myDoughnutElement, {
type: 'doughnut', // チャートのタイプ
data: { // チャートの内容
labels: ["one", "two", "three"],
datasets: [{
label: 'doughnut',
lineTension: 0, // ベジェ曲線を無効化
data: [14, 10, 6],
backgroundColor: ['RGBA(182,39,93, 1)', 'RGBA(77,169,155, 1)', 'RGBA(46,106,177,1)'],
borderWidth: 5
}]
},
options: { // チャートのその他オプション
// 設定なし
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment