Skip to content

Commit

Permalink
[bugfix] bignumber comparison wrong with neg values (#1743)
Browse files Browse the repository at this point in the history
* [bugfix] bignumber comparison wrong with neg values

* Handling zero div
  • Loading branch information
mistercrunch authored Dec 4, 2016
1 parent b045075 commit a3106bc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion superset/assets/visualizations/big_number.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ function bigNumberVis(slice) {
if (json.compare_lag > 0) {
const pos = data.length - (json.compare_lag + 1);
if (pos >= 0) {
vCompare = (v / data[pos][1]) - 1;
const vAnchor = data[pos][1];
if (vAnchor !== 0) {
vCompare = (v - vAnchor) / Math.abs(vAnchor);
}
}
}
const dateExt = d3.extent(data, (d) => d[0]);
Expand Down

0 comments on commit a3106bc

Please sign in to comment.