Skip to content

Commit

Permalink
building miniviz
Browse files Browse the repository at this point in the history
  • Loading branch information
norlab committed Apr 8, 2018
1 parent f4c6978 commit bdc34f8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions paperbuzzviz.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,35 @@ function PaperbuzzViz(options) {

if (showMini) {

// Build category html objects.
vizDiv.append("div")
.attr("class", "paperbuzz-mini-row")
.attr("style", "width: 100%; overflow: hidden;")
.attr("id", "mini");

vizDiv.append("h3")
.attr("class", "paperbuzz-mini-row-heading")
.attr("id", "mini-something")
.html('TIMELINE');

var total = 0;
for (i = 0; i < data.altmetrics_sources.length; i++) {
total += data.altmetrics_sources[i].events_count;
}


function calculateYears(pub_date) {
var years = (new Date()).getFullYear() - pub_date.getFullYear();
return Math.ceil(years);
}
console.log(pub_date);
vizDiv.append("p")
.attr("class", "paperbuzz-mini-row-heading")
.attr("id", "mini-something")
.text(total + ' Online mentions over ' + calculateYears(pub_date) + ' year(s)');



//var total = 0;
//for (i = 0; i < data.altmetrics_sources.length; i++) {
// total += data.altmetrics_sources[i].events_count;
Expand Down

0 comments on commit bdc34f8

Please sign in to comment.