diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/KPIChart.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/KPIChart.tsx index ad9b04d038d..c2fc163834a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/KPIChart.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/KPIChart.tsx @@ -267,7 +267,9 @@ const KPIChart: FC = ({ chartFilter, kpiList }) => { )} ) : ( - + + + )} ) : ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/ProfilerDetailsCard.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/ProfilerDetailsCard.tsx index 790caf1af4a..8b00da2f7f9 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/ProfilerDetailsCard.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/ProfilerDetailsCard.tsx @@ -69,7 +69,7 @@ const ProfilerDetailsCard: React.FC = ({ + margin={{ left: 16 }}> {value}; export const axisTickFormatter = (value: number, tickFormatter?: string) => { - return tickFormatter - ? `${value}${tickFormatter}` - : toString(getStatisticsDisplayValue(value)); + return tickFormatter ? `${value}${tickFormatter}` : digitFormatter(value); }; export const updateActiveChartFilter = ( diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.test.ts b/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.test.ts index b6ded0995e5..55a636aab02 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.test.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.test.ts @@ -25,7 +25,11 @@ import { } from './CommonUtils.mock'; import { cloneDeep } from 'lodash'; -import { getNameFromFQN, sortTagsCaseInsensitive } from './CommonUtils'; +import { + digitFormatter, + getNameFromFQN, + sortTagsCaseInsensitive, +} from './CommonUtils'; import { mockFQN, mockTags, sortedMockTags } from './CommonUtils.mock'; describe('Tests for CommonUtils', () => { @@ -88,5 +92,24 @@ describe('Tests for CommonUtils', () => { expect(containsDoubleQuotes > 0).toBe(false); }); + + // digitFormatter test + it('digitFormatter formatter should format number 1000 to 1k', () => { + const values = [ + { value: 1000, result: '1K' }, + { value: 10000, result: '10K' }, + { value: 10200, result: '10.2K' }, + { value: 1000000, result: '1M' }, + { value: 100000000, result: '100M' }, + { value: 1000000000, result: '1B' }, + { value: 1500000000, result: '1.5B' }, + { value: 1000000000000, result: '1T' }, + { value: 1100000000000, result: '1.1T' }, + ]; + + values.map(({ value, result }) => { + expect(digitFormatter(value)).toEqual(result); + }); + }); }); }); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx index 5e343915554..ca63d29cd35 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/CommonUtils.tsx @@ -664,6 +664,14 @@ export const formTwoDigitNmber = (number: number) => { }); }; +export const digitFormatter = (value: number) => { + // convert 1000 to 1k + return Intl.NumberFormat('en', { + notation: 'compact', + maximumFractionDigits: 1, + }).format(value); +}; + export const getTeamsUser = ( data?: ExtraInfo ): Record | undefined => {