Clean up max-category front-end limit (#2347)

* remove topN category truncation from component rendering layer

* clean up category item limit implementation

* name change for clarity

* fix snapshot

* comments
This commit is contained in:
Bruce Martin
2021-07-29 16:05:10 -07:00
committed by GitHub
parent 27575b8d86
commit 8136387127
11 changed files with 215 additions and 167 deletions
+6 -3
View File
@@ -76,10 +76,13 @@ export function summarizeCategorical(col: any) {
categoryCounts.set(val, curCount + 1);
}
}
const sortedCategoryByCounts = new Map(
[...categoryCounts.entries()].sort((a, b) => b[1] - a[1])
);
return {
categorical: true,
categories: [...categoryCounts.keys()],
categoryCounts,
numCategories: categoryCounts.size,
categories: [...sortedCategoryByCounts.keys()],
categoryCounts: sortedCategoryByCounts,
numCategories: sortedCategoryByCounts.size,
};
}