I'm building an app using laravel/php. I having using how to map and sort my array. Is there anyone can help me how to fix this? I have this two different array. The first picture is the label and second is my data.
I am trying to map the label to data and sort my data to min to max But I only did it using javascript.
Here is my sample code.
$arrayOfObjIssues = $arrayLabelIssues.map(function($d, $i) {
return {
label: $d,
data: $arrayDataIssues[$i] || 0
};
});
$sortedArrayOfObjIssues = $arrayOfObjIssues.sort(function($a, $b) {
return $b.data>$a.data;
});
$newArrayLabelIssues = [];
$newArrayDataIssues = [];
$sortedArrayOfObjIssues.forEach(function($d){
$newArrayLabelIssues.push($d.label);
$newArrayDataIssues.push($d.data);
});
How can I able to fix this? All help are welcome. Thank you in advance.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire