Skip to content

Instantly share code, notes, and snippets.

@codetricity
Created February 7, 2018 14:30
Show Gist options
  • Save codetricity/aaea2d19fd4d64c2ff82a85a3541a00f to your computer and use it in GitHub Desktop.
Save codetricity/aaea2d19fd4d64c2ff82a85a3541a00f to your computer and use it in GitHub Desktop.
Example use of Chart.js as doughnut chart
<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