Skip to content

Commit

Permalink
chore: add sorting to the facets
Browse files Browse the repository at this point in the history
  • Loading branch information
dv-usama-ansari committed Dec 18, 2024
1 parent 3eb3979 commit eff335f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/vis/bar/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ export function BarChart({
const allUniqueFacetVals = React.useMemo(() => {
const set = new Set();
barData?.facetsColVals?.resolvedValues.forEach((v) => set.add(getLabelOrUnknown(v.val)));
return [...set] as string[];
const uniqueFacetValues = [...set] as string[];
return uniqueFacetValues.sort((a, b) => (a === NAN_REPLACEMENT || b === NAN_REPLACEMENT ? 1 : a && b ? a.localeCompare(b) : 0));
}, [barData?.facetsColVals?.resolvedValues]);

const filteredUniqueFacetVals = React.useMemo(() => {
Expand Down

0 comments on commit eff335f

Please sign in to comment.