fix zero value number format

This commit is contained in:
saml33 2023-11-03 09:52:17 +11:00
parent bb2b0201a7
commit dbe7a60c0c
2 changed files with 6 additions and 1 deletions

View File

@ -415,7 +415,10 @@ const DetailedAreaOrBarChart: FunctionComponent<
type="monotone"
dataKey={yKey}
stroke={
calculateChartChange() >= 0
calculateChartChange() === 0 ||
isNaN(calculateChartChange())
? COLORS.FGD4[theme]
: calculateChartChange() >= 0
? COLORS.UP[theme]
: COLORS.DOWN[theme]
}

View File

@ -11,6 +11,8 @@ export const formatNumericValue = (
formattedValue = roundUp
? roundValue(numberValue, decimals, true)
: roundValue(numberValue, decimals)
} else if (numberValue === 0) {
formattedValue = numberValue.toFixed(decimals || 0)
} else if (numberValue > -0.0000000001 && numberValue < 0.000000001) {
formattedValue = numberValue.toExponential(3)
} else if (Math.abs(numberValue) >= 1000) {