Hey,
I’m having a lot of trouble with sorting my labels alphabetically. I’m making a barchart that displays the list of games you own via the Steam API. I’ve managed to sort my data by it’s value, but the alphabetical sorting of the labels looks okay at first glance, but there’s just too many inconsistencies and I don’t this recursion all too well yet.
This is the code for sorting alphabetically ascending/descending
function compareDataPointAlphaAscend(dataPoint1, dataPoint2) {
return dataPoint2.label[0] > dataPoint1.label[0];
}
function compareDataPointAlphaDescend(dataPoint1, dataPoint2) {
return dataPoint1.label[0] > dataPoint2.label[0];
}
newData.dataPoints.sort(compareDataPointAlphaAscend);
But the results are a little inconsistent. There’s always a couple games in there that shouldn’t be.
i.imgur.com/Nfcd1PL.png
i.imgur.com/zTYZ083.png
Thanks