From dbe9f3a034f36e17c41b26c1da5c56cbcceadfb4 Mon Sep 17 00:00:00 2001 From: Pranshu Chittora Date: Wed, 4 May 2022 17:52:14 +0530 Subject: [PATCH] fix: chart y-axis values not showing for values < 1 --- frontend/src/components/Graph/index.tsx | 5 +---- frontend/src/components/Graph/yAxisConfig.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Graph/index.tsx b/frontend/src/components/Graph/index.tsx index e51ff21616..0bd22962f6 100644 --- a/frontend/src/components/Graph/index.tsx +++ b/frontend/src/components/Graph/index.tsx @@ -160,10 +160,7 @@ function Graph({ ticks: { // Include a dollar sign in the ticks callback(value) { - return getYAxisFormattedValue( - parseInt(value.toString(), 10), - yAxisUnit, - ); + return getYAxisFormattedValue(parseFloat(value.toString()), yAxisUnit); }, }, }, diff --git a/frontend/src/components/Graph/yAxisConfig.ts b/frontend/src/components/Graph/yAxisConfig.ts index 5434eeceb3..2a0c4766a1 100644 --- a/frontend/src/components/Graph/yAxisConfig.ts +++ b/frontend/src/components/Graph/yAxisConfig.ts @@ -6,7 +6,7 @@ export const getYAxisFormattedValue = ( ): string => { try { return formattedValueToString( - getValueFormat(format)(value, undefined, undefined, undefined), + getValueFormat(format)(value, 1, undefined, undefined), ); } catch (error) { console.error(error);