I am trying to do the same thing as here : ChartJS - Different color per data point
But in PHP so I cant use the javascript selectors like the accepted answers there.
To build my charts I use PHP sessions var in SQL request so it is necessary to integrate the code with PHP. I have several charts that I load with Ajax with a switch case.
I instanciate the value of Chartjs parameters like this :
$html .= "<p>Results from " . $_SESSION['statDateFrom'] . " to " . $_SESSION['statDateTo'] . "</p>";
    $html .= "<canvas id='myChart' width='400' height='300'>";
    $html .= "</canvas>";
    $html .= $legend;
    $html .= "<script>";
    $html .= "var ctx=document.getElementById('myChart').getContext('2d');";
    $html .= "var myChart = new Chart(ctx, {";
    $html .= "type:'". $type . "',";
    $html .= "data:" . $mydata . ",";
    $html .= "options: " . $options;
    $html .= "});";
    $html .= "</script>";
And the chart that I want to custom here is a line chart on which I only keep the dot. I want to color the dot with different colors value depending on the Y axis value
For now I've tried this :
$arrDatasets = array(
                array('label' => "event_name",
                      'fill' => false,
                      'showLine' => false,
                      'pointBackgroundColor' => array("#82f827", "#ff4040", "#31698A", "#6666FF","#ff7F50","#fe6b60","#6c1ba1","#97bdd6"),
                      'data' => $datasetR1
                      ));
            $arrReturn = (array('labels' => $labels, 
                    'datasets' => $arrDatasets));
            $mydata = json_encode(($arrReturn));
Passing an array to pointBackgroundColor definitively change the colors of the points but it only adds the colors to the first results!
So I guess I just have to do a loop with conditions but I don't know how to proceed.

