Skip to content

Commit 586542b

Browse files
Did changes based on suggestion
1 parent 3e9500d commit 586542b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/plots/plots.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -3207,8 +3207,12 @@ function sortAxisCategoriesByValue(axList, gd) {
32073207
median: function(values) {return Lib.median(values);}
32083208
};
32093209

3210-
function sortValues(a, b, order) {
3211-
return order === 'descending' ? b[1] - a[1] : a[1] - b[1];
3210+
function sortAscending (a, b) {
3211+
return a[1] - b[1];
3212+
}
3213+
3214+
function sortDescending (a, b) {
3215+
return b[1] - a[1];
32123216
}
32133217

32143218
for(i = 0; i < axList.length; i++) {
@@ -3332,7 +3336,7 @@ function sortAxisCategoriesByValue(axList, gd) {
33323336
}
33333337

33343338
// Sort by aggregated value
3335-
categoriesAggregatedValue.sort((a,b) => sortValues(a, b, order));
3339+
categoriesAggregatedValue.sort(order === 'descending' ? sortDescending : sortAscending);
33363340

33373341
ax._categoriesAggregatedValue = categoriesAggregatedValue;
33383342

0 commit comments

Comments
 (0)