mardi 31 mars 2015

How to use color of my choice for each bar in a bar chart using chartjs?

I want the bars in this graph to have different colors, but of my choice. Here is my code. Please Help.



var ctx = $("#myBarChart").get(0).getContext("2d");
var data = {
labels: ["a","b","c","d","e","f","g"],
datasets: [
{
label: "My First dataset",
/*fillColor: "rgba(84,255,159,1)",
highlightFill: "rgba(84,255,159,0.75)",*/
data: [5,3, 4, 2, 1, 3, 1]
},
]
};



var myBarChart = new Chart(ctx).Bar(data);
var width = $('canvas').parent().width();
$('canvas').attr("width",width);
new Chart(ctx).Bar(data);

Aucun commentaire:

Enregistrer un commentaire