Connect the bar chart to the group by resolver (#14885)

Closes https://github.com/twentyhq/core-team-issues/issues/1535

Video QA:


https://github.com/user-attachments/assets/153fa3f1-08d9-4952-9456-635c602e1f57



https://github.com/user-attachments/assets/d3111afb-4c84-4f57-8a56-5cf666748c86

There are still some formatting and design issues (the labels which are
on top of each other and the values which should be formatted) that will
be fixed in a future PR

---------

Co-authored-by: ehconitin <nitinkoche03@gmail.com>
This commit is contained in:
Raphaël Bosi
2025-10-09 14:54:33 +02:00
committed by GitHub
parent 973b4fef90
commit 875dc1a6b8
50 changed files with 1653 additions and 70 deletions
@@ -31,6 +31,7 @@ export const computeAggregateValueAndLabel = ({
timeZone,
localeCatalog,
formatNumberFn,
formatShortNumberFn,
}: {
data: AggregateRecordsData;
objectMetadataItem: ObjectMetadataItem;
@@ -44,6 +45,7 @@ export const computeAggregateValueAndLabel = ({
value: number,
options?: Omit<FormatNumberOptions, 'format'>,
) => string;
formatShortNumberFn?: (value: number) => string | number;
}) => {
const formatNumber =
formatNumberFn ??
@@ -95,7 +97,9 @@ export const computeAggregateValueAndLabel = ({
switch (field.type) {
case FieldMetadataType.CURRENCY: {
value = Number(aggregateValue);
value = formatToShortNumber(value / 1_000_000);
value = isDefined(formatShortNumberFn)
? formatShortNumberFn(value / 1_000_000)
: formatToShortNumber(value / 1_000_000);
break;
}