[Chartjs]-Can't get bar chart colors in Chart js working in React Js

11πŸ‘

βœ…

So I was able to get the colors working by doing this:

    datasets: [
        {
            label: "My First dataset",
            fillColor: ["rgba(0,10,220,0.5)","rgba(220,0,10,0.5)","rgba(220,0,0,0.5)","rgba(120,250,120,0.5)" ],
            strokeColor: "rgba(220,220,220,0.8)", 
            highlightFill: "rgba(220,220,220,0.75)",
            highlightStroke: "rgba(220,220,220,1)",
            data: pokeDataSet
        }

Hope this can help someone who has a similar issue!

0πŸ‘

The background color will change the color of the bars.

So, you can give different colors to different bar.

datasets: [
          {
        label: 'My First dataset',
        backgroundColor: ['rgba(0,10,220,0.5)', 'rgba(220,0,10,0.5)'],
        borderColor: 'rgba(0,0,0,1)',
        data: pokeDataSet,
          },
    ],

Leave a comment