๐:0
I think what you need is to filter your dataset before calling chartjs to create the chart. Is there any reason not to do that?
๐:0
$sumofvars=array_sum($output);
$above_percent=0.1;
foreach($output as $compound => $sum){
$percentage_to_eliminate=($sum/$sumofvars)*100;
if ($percentage_to_eliminate>$above_percent)
{
echo "{category: '".$compound."', value: ".$sum."}, ";
}
}
?>
];