mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04: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:
parent
96a63bcbfe
commit
aa53c10312
@ -125,8 +125,10 @@ export default function transformProps(
|
|||||||
if (compareIndex < sortedData.length) {
|
if (compareIndex < sortedData.length) {
|
||||||
const compareValue = sortedData[compareIndex][1];
|
const compareValue = sortedData[compareIndex][1];
|
||||||
// compare values must both be non-nulls
|
// compare values must both be non-nulls
|
||||||
if (bigNumber !== null && compareValue !== null && compareValue !== 0) {
|
if (bigNumber !== null && compareValue !== null) {
|
||||||
percentChange = (bigNumber - compareValue) / Math.abs(compareValue);
|
percentChange = compareValue
|
||||||
|
? (bigNumber - compareValue) / Math.abs(compareValue)
|
||||||
|
: 0;
|
||||||
formattedSubheader = `${formatPercentChange(
|
formattedSubheader = `${formatPercentChange(
|
||||||
percentChange,
|
percentChange,
|
||||||
)} ${compareSuffix}`;
|
)} ${compareSuffix}`;
|
||||||
|
Loading…
Reference in New Issue
Block a user