Skip to content

Instantly share code, notes, and snippets.

@marorika
Last active April 4, 2018 16:02
Show Gist options
  • Save marorika/765380b103f06f582cf1451d494776f4 to your computer and use it in GitHub Desktop.
Save marorika/765380b103f06f582cf1451d494776f4 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="myPie" style="width: 100%; height: 300px;"></canvas>
<script>
var myPieElement = document.getElementById("myPie");
var myPie = new Chart(myPieElement, {
type: 'pie', // チャートのタイプ
data: { // チャートの内容
labels: ["one", "two", "three"],
datasets: [{
label: 'pie',
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