Skip to content

Commit

Permalink
Big Number Viz: (#20946)
Browse files Browse the repository at this point in the history
- When the value is zero we still render the percent change and suffix if present
  • Loading branch information
Antonio-RiveroMartnez authored Aug 3, 2022
1 parent 96a63bc commit aa53c10
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down

0 comments on commit aa53c10

Please sign in to comment.