Skip to content

Commit

Permalink
Improve initial sorting of categories for categorical maps
Browse files Browse the repository at this point in the history
  • Loading branch information
mthh committed Sep 25, 2024
1 parent 065aec7 commit 5d48822
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/helpers/categorical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export const makeCategoriesMapping = (
color: isNonNull(c[0]) ? colors[j++] : '',
count: c[1],
}))
.sort((a, b) => a.categoryName - b.categoryName);
.sort((a, b) => (
// eslint-disable-next-line no-nested-ternary
(a.categoryName > b.categoryName) ? 1 : ((b.categoryName > a.categoryName) ? -1 : 0)));
};

export const makePictoCategoriesMapping = (
Expand All @@ -72,4 +74,6 @@ export const makePictoCategoriesMapping = (
iconContent: images[i % images.length],
iconDimension: [50, 50],
} as CategoricalPictogramMapping))
.sort((a, b) => a.categoryName - b.categoryName);
.sort((a, b) => (
// eslint-disable-next-line no-nested-ternary
(a.categoryName > b.categoryName) ? 1 : ((b.categoryName > a.categoryName) ? -1 : 0)));

0 comments on commit 5d48822

Please sign in to comment.