Chartjs-Customized Doughnut char using charjs

2๐Ÿ‘

โœ…

You need to add colors for each label in datasets

'datasets'=> [{
             'label' => 'level',
             'data' => [10,20,30,40],
            backgroundColor: [
                'rgba(75, 192, 192, 0.2)', // green
                'rgba(255, 206, 86, 0.2)', // yellow
                'rgba(54, 162, 235, 0.2)', // blue
                'rgba(255, 99, 132, 0.2)', // red

            ], 
        }]

Check this link for more options http://www.chartjs.org/docs/latest/

2๐Ÿ‘

you should add the cooresponding color

  'datasets' => [
            [
                'label' => 'level',
                'data' => [10,20,30,40],
                'backgroundColor' => ["green", "yellow","blue" ,"red"],

            ],

Leave a comment