Skip to content

Instantly share code, notes, and snippets.

@tomwis
Created February 11, 2018 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomwis/a878cf2003aed7e4cbf6230a620f8982 to your computer and use it in GitHub Desktop.
Save tomwis/a878cf2003aed7e4cbf6230a620f8982 to your computer and use it in GitHub Desktop.
<canvas id="myChart" width="200" height="200"></canvas>
<script>
var ctx = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["Red", "Blue"],
datasets: [{
label: 'Which color do you like?',
data: [12, 19],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)'
],
borderColor: [
'rgba(255,99,132,1)',
'rgba(54, 162, 235, 1)'
],
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment