Skip to content

Commit

Permalink
Big Number Viz: (apache#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 Fahrenheit35 committed Nov 11, 2022
1 parent c51fd2a commit 0670c4d
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 0670c4d

Please sign in to comment.