diff --git a/components/shared/DetailedAreaOrBarChart.tsx b/components/shared/DetailedAreaOrBarChart.tsx index cde29dd2..94273cf1 100644 --- a/components/shared/DetailedAreaOrBarChart.tsx +++ b/components/shared/DetailedAreaOrBarChart.tsx @@ -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] } diff --git a/utils/numbers.ts b/utils/numbers.ts index 5943feaf..5783a1f5 100644 --- a/utils/numbers.ts +++ b/utils/numbers.ts @@ -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) {