Big Number Viz: (#20946)

- When the value is zero we still render the percent change and suffix if present
This commit is contained in:
Antonio Rivero Martinez 2022-08-03 12:12:56 -03:00 committed by GitHub
parent 96a63bcbfe
commit aa53c10312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -125,8 +125,10 @@ export default function transformProps(
if (compareIndex < sortedData.length) {
const compareValue = sortedData[compareIndex][1];
// compare values must both be non-nulls
if (bigNumber !== null && compareValue !== null && compareValue !== 0) {
percentChange = (bigNumber - compareValue) / Math.abs(compareValue);
if (bigNumber !== null && compareValue !== null) {
percentChange = compareValue
? (bigNumber - compareValue) / Math.abs(compareValue)
: 0;
formattedSubheader = `${formatPercentChange(
percentChange,
)} ${compareSuffix}`;