1

I am new with Chart.js and attempting to change the color of a dot or point when a certain value of a data is achieved. My backend program is PHP. I was guessing that color is the correct parameter but no luck. Is this possible using Charts.js?

var scatterChartData = {
    datasets: [{
        label: 'My First dataset',
        data: [
            <?php for($x = 0; $x < $total; $x++) {?>
            {
                x: <?php round($data[$x]['PosX'],2); ?>,
                y: <?php round($data[$x]['PosY'],2); ?>,
                color: '<?php ($data[$x]['Value'] > 1)? 'red':'green' ; ?>'
            }, 
            <?php }?>  
        ]
    }]
};
Nic3500
  • 8,144
  • 10
  • 29
  • 40
Sarotobi
  • 707
  • 1
  • 9
  • 28

0 Answers0