I have a Chart.js bar chart that has its backgroundColor
set as an array.
Example:
{
type: 'bar',
label: "...",
data: [...],
borderColor: '...',
backgroundColor: ["var_color1", "var_color2", ..., "var_color3"],
yAxisID: 'y',
}
The legend above the chart always takes the first color in the backgroundColor
array, but I want it to be a static color that I can set manually.
For instance, to always be green here and not the first color in the array that is orange:
Could anyone please provide a solution for this case?
Please note that I am using react-chartjs-2
.