Skip to content

Instantly share code, notes, and snippets.

@codetricity
Last active February 6, 2018 02:42
Show Gist options
  • Save codetricity/cc01db9ab54a7bb13cabe6801d134077 to your computer and use it in GitHub Desktop.
Save codetricity/cc01db9ab54a7bb13cabe6801d134077 to your computer and use it in GitHub Desktop.
caitlyn Chart.js example lesson #1
<head>
<script src="Chart.js"></script>
<style>
canvas {
border: 1px;
border-color:black;
border-style: solid;
}
</style>
</head>
<body>
<title> Stuffies!</title>
<h1> Stuffie February Sales</h1>
<canvas id="myChart" width="440" height="440"></canvas>
<script>
var context = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(context, {
type: 'bar',
data: {
labels: ["Palo Alto", "San Francisco", "Harajuku"],
datasets: [{
label: '# of Stuffies',
data: [60, 153, 383],
backgroundColor: [
'rgba(160, 66, 255, 0.2)',
'rgba(255, 66, 232, 0.2)',
'rgba(97, 66, 255, 0.2)'
]
}]
},
options: {
responsive: false
}
})
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment