From 7322e779a337d715658865b0b01bfb7e32d7f9bf Mon Sep 17 00:00:00 2001 From: Juan Pablo Alperin Date: Fri, 9 Mar 2018 09:38:40 -0800 Subject: [PATCH] changed article --- index2.html | 4 ++-- script5.js | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/index2.html b/index2.html index e380b68..f49587d 100755 --- a/index2.html +++ b/index2.html @@ -42,9 +42,9 @@

Paperbuzz Visualizations

var paperbuzzviz = undefined; var doi = '10.1371/journal.pmed.0020124'; - var doi = '10.7287/peerj.preprints.3119v1'; + var doi = '10.1007/s00266-017-0820-4'; - + var doi = '10.7287/peerj.preprints.3119v1'; d3.json('https://api.paperbuzz.org/v0/doi/' + doi, function(data) { options.paperbuzzStatsJson = data paperbuzzviz = new PaperbuzzViz(options); diff --git a/script5.js b/script5.js index fa0c492..f9bffcf 100755 --- a/script5.js +++ b/script5.js @@ -26,11 +26,11 @@ function PaperbuzzViz(options) { // TODO: Fix to use parseDate // TODO: Fix to work when no pub date is available. Use earliest event - var year = data.metadata["published-online"]["date-parts"][0][0]; - var month = data.metadata["published-online"]["date-parts"][0][1]; - var day = data.metadata["published-online"]["date-parts"][0][2]; - // var published_date = '2017-08-02'; // year+"-"+month+"-"+day; - var published_date = year+"-"+month+"-"+day; + // var year = data.metadata["published-online"]["date-parts"][0][0]; + // var month = data.metadata["published-online"]["date-parts"][0][1]; + // var day = data.metadata["published-online"]["date-parts"][0][2]; + var published_date = '2017-08-02'; // year+"-"+month+"-"+day; + // var published_date = year+"-"+month+"-"+day; // extract publication date var pub_date = parseDate(published_date); @@ -451,7 +451,16 @@ function PaperbuzzViz(options) { var yAxis = d3.axisLeft(viz.y) .tickValues([d3.max(viz.y.domain())]); - var xAxis = d3.axisBottom(viz.x); + var ticks; + if (level == 'day') { + ticks = d3.timeDay.every(4); + } else if (level == 'month') { + ticks = d3.timeMonth.every(2); + } else { + ticks = d3.timeYear.every(1) + } + var xAxis = d3.axisBottom(viz.x) + .ticks(ticks); // // The chart itself