Created
June 22, 2017 09:01
-
-
Save evilnapsis/38f75628c41a1055156de5b858a9636d to your computer and use it in GitHub Desktop.
Grafica de Pie [Multiple Datasets] con Chart.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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