Skip to content

Commit

Permalink
fix: handle null values in time-series table (apache#18039)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo authored and bwang221 committed Feb 10, 2022
1 parent 0116e15 commit b601660
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions superset-frontend/src/visualizations/TimeTable/TimeTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,17 @@ const TimeTable = ({
} else {
v = reversedEntries[timeLag][valueField];
}
if (column.comparisonType === 'diff') {
v = recent - v;
} else if (column.comparisonType === 'perc') {
v = recent / v;
} else if (column.comparisonType === 'perc_change') {
v = recent / v - 1;
if (typeof v === 'number' || typeof recent === 'number') {
if (column.comparisonType === 'diff') {
v = recent - v;
} else if (column.comparisonType === 'perc') {
v = recent / v;
} else if (column.comparisonType === 'perc_change') {
v = recent / v - 1;
}
} else {
v = 'N/A';
}
v = v || 0;
} else if (column.colType === 'contrib') {
// contribution to column total
v =
Expand Down

0 comments on commit b601660

Please sign in to comment.