Reputation: 535
I have created a barchart with chart.js but all the bars are grey colored. How do I make them all blue? Heres my code:
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: dates,
datasets: [
{
data: values
}
]
}
});
From reading the documentation it seems that I need to change the property: backgroundColor. So there should be a line somewhere with something like:
backgroundColor: 'blue'
or something similar. I haven't been able to find an answer to this and all the examples in the documentation are way more complicated than what I need.
Upvotes: 0
Views: 47
Reputation: 996
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: dates,
datasets: [
{
backgroundColor: ["#0000FF"],
data: values
}
]
}
});
Upvotes: 1