Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
fix(Chart): order labels (x)
Browse files Browse the repository at this point in the history
Signed-off-by: reslene <[email protected]>
  • Loading branch information
reslene committed Mar 6, 2023
1 parent 4a64472 commit b11495e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions app/src/components/Dataviz/Charts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,15 @@ export const buildLabels = (
) as string[];

return uniqLabels

.sort((a, b) => (dayjs(a) < dayjs(b) ? 1 : -1))
.reverse()
.map((item: Date | string) => {
const date = dayjs(item);
if (date.isValid()) {
return date.format(dateFormat);
}

return item;
})
.sort((a, b) => {
if (typeof a === 'string' && typeof b === 'string') {
return dayjs(a) < dayjs(b) ? 1 : -1;
}

return a < b ? 1 : -1;
})
.reverse();
});
};

0 comments on commit b11495e

Please sign in to comment.