mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
Big Number Viz: (#20946)
- When the value is zero we still render the percent change and suffix if present
This commit is contained in:
committed by
GitHub
parent
96a63bcbfe
commit
aa53c10312
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user