I've updated my chartjs version to 3.5.1 and I cant set my background color for line chart. Border color is still active. Here is my code:
const labels = [
'January',
'February',
'March',
'April',
'May',
'June',
];
const data = {
labels: labels,
datasets: [{
label: 'My First dataset',
backgroundColor: 'rgb(255, 99, 132)',
borderColor: 'rgb(255, 99, 132)',
data: [0, 10, 5, 2, 20, 30, 45],
fill: true,
}]
};
this.chart = new Chart(ctx, {
type: 'line',
data: data,
options: this.options,
})
And the result is: enter image description here
Thanks for your help!
CodePudding user response:
It seems to work fine for me. Only thing I can think of is that you are using treeshaking import and don't have the filler plugin imported and registered like so:
import { Chart, Filler } from 'chart.js';
Chart.register(Filler)
Alternatively you can also let chart.js import and register everything so you don't encounter these kind of problems like so:
import Chart from 'chart.js/auto';