mirror of https://github.com/apache/superset.git
Big Number Viz: (#20946)
- When the value is zero we still render the percent change and suffix if present
This commit is contained in:
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}`;
|
||||
|
|
Loading…
Reference in New Issue