Skip to content

Instantly share code, notes, and snippets.

@andregardi
Last active October 1, 2018 00:37
Show Gist options
  • Save andregardi/40c3ccb195f61ed9cc6466ba61e18f2e to your computer and use it in GitHub Desktop.
Save andregardi/40c3ccb195f61ed9cc6466ba61e18f2e to your computer and use it in GitHub Desktop.
var labels = [
"Vote for blue",
"vote for red",
];
var data = [
70,
30,
];
var pie = document.getElementById("pieChart").getContext('2d');
var myChart = new Chart(pie, {
type: 'pie',
data: {
labels: labels,
datasets: [
{
data: data,
borderColor: ['rgba(75, 192, 192, 1)', 'rgba(192, 0, 0, 1)'],
backgroundColor: ['rgba(75, 192, 192, 0.2)', 'rgba(192, 0, 0, 0.2)'],
}
]
},
options: {
title: {
display: true,
text: "Colors election"
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment