Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into highlightHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyichen committed May 20, 2021
2 parents 290447a + a73e09c commit c1c3a1b
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 c1c3a1b

Please sign in to comment.