Chartjs-Chartjs – Loop thru dataset and assign colors

0👍

foreach($datasetR1 as $value){
                if($value == 1){
                    array_push($intColors, "#82f827");
                }
                elseif($value == 2){
                    array_push($intColors, "#ff4040");
                }
                elseif($value == 3){
                    array_push($intColors, "#31698A");
                }
                elseif($value == 4){
                    array_push($intColors, "#6666FF");
                }
                elseif($value == 5){
                    array_push($intColors, "#ff7F50");
                }
                elseif($value == 6){
                    array_push($intColors, "#fe6b60");
                }
                elseif($value == 7){
                    array_push($intColors, "#6c1ba1");
                }
                elseif($value == 8){
                    array_push($intColors, "#97bdd6");
                }
            }

Leave a comment