Skip to content

Commit

Permalink
fix: handle null values in time-series table
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo committed Jan 13, 2022
1 parent 343d3f8 commit 83a4895
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 83a4895

Please sign in to comment.