Chartjs-Plotting bars with react with different colors, but they're all in black why?

1👍

you have to use cells property :

  cells: data.map(m => ({fill: COLORS[m.title]}))

0👍

fill: data.map(m => COLORS[m.title])

Yours map is wrong. I guess the fill expects an array of colors. But you are accessing COLORS key with a mapped array which will be always undefined.

Leave a comment