Skip to content

Commit

Permalink
Merge 95c0a4e into ced0e1f
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyichen authored May 19, 2021
2 parents ced0e1f + 95c0a4e commit 8cc0e2d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/js/widgets/metrics/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,16 @@ define([
? 'normalizedGraphData'
: 'graphData';
var data = that.model.get(dataType);
return data
.map(function(obj) {
var title = obj.key;
var val = _.findWhere(obj.values, { x: d.x }).y;
return '<b>' + title + '</b>:&nbsp;' + val.toFixed(2);
})
.join('<br/>');

let sum = 0;
const res = data.map(function(obj) {
var title = obj.key;
var val = _.findWhere(obj.values, { x: d.x }).y;
sum += val;
return '<b>' + title + '</b>:&nbsp;' + val.toFixed(2);
});
res.push(`<b>Total</b>:&nbsp;${sum.toFixed(2)}`);
return res.join('<br/>');
});
}

Expand Down

0 comments on commit 8cc0e2d

Please sign in to comment.