Created
February 7, 2018 14:30
-
-
Save codetricity/aaea2d19fd4d64c2ff82a85a3541a00f to your computer and use it in GitHub Desktop.
Example use of Chart.js as doughnut chart
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
<script src="Chart.js"></script> | |
<canvas id="myChart" width="400" height="400"></canvas> | |
<script> | |
context = document.getElementById('myChart').getContext('2d'); | |
var pieChart = new Chart(context, { | |
type: 'doughnut', | |
data: { | |
labels: ['dog', 'cat', 'turtle', 'fish'], | |
datasets: [{ | |
data: [4, 7, 9, 1], | |
backgroundColor: [ | |
'red', 'green', 'aqua', 'tan' | |
] | |
}] | |
}, | |
options: { | |
responsive: false, | |
} | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment