Skip to content

Instantly share code, notes, and snippets.

@evilnapsis
Created June 22, 2017 09:01
Show Gist options
  • Save evilnapsis/38f75628c41a1055156de5b858a9636d to your computer and use it in GitHub Desktop.
Save evilnapsis/38f75628c41a1055156de5b858a9636d to your computer and use it in GitHub Desktop.
Grafica de Pie [Multiple Datasets] con Chart.js
var ctx = document.getElementById("chart1");
var red = "#f00";
var orange = "#f50";
var yellow = "#ff0";
var green = "#0f0";
var blue = "#00f";
var myPieChart = new Chart(ctx,{
type: 'pie',
data: {
datasets: [{
data: [ 1,2,3,4,5 ],
backgroundColor: [ red, orange, yellow,green, blue],
label: 'Dataset 1'
},
{
data: [ 2,6,9,3,1 ],
backgroundColor: [ red, orange, yellow,green, blue],
label: 'Dataset 2'
}
],
labels: [ "Red", "Orange", "Yellow", "Green", "Blue" ]
},
options: {
responsive: true
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment