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

(cherry picked from commit aa53c10)
  • Loading branch information
Antonio-RiveroMartnez authored and eschutho committed Sep 14, 2022
1 parent 8c2ca2d commit 6a5b12e
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 6a5b12e

Please sign in to comment.