Skip to content

Commit

Permalink
few more tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jalperin committed Mar 13, 2018
1 parent b5eaf23 commit f3387a8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
14 changes: 7 additions & 7 deletions index2.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ <h1>Paperbuzz Visualizations</h1>
var options = {
baseUrl: 'http://pkp-alm.lib.sfu.ca',
minItemsToShowGraph: {
minEventsForYearly: 1,
minEventsForMonthly: 1,
minEventsForDaily: 1,
minYearsForYearly: 1,
minEventsForYearly: 6,
minEventsForMonthly: 6,
minEventsForDaily: 6,
minYearsForYearly: 4,
minMonthsForMonthly: 1,
minDaysForDaily: 1
minDaysForDaily: 5
},
showTitle: true,

Expand All @@ -46,8 +46,8 @@ <h1>Paperbuzz Visualizations</h1>
var paperbuzzviz = undefined;
var doi = '10.1371/journal.pmed.0020124';

var doi = '10.1007/s00266-017-0820-4';
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);
Expand Down
23 changes: 14 additions & 9 deletions script5.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ 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 = year+"-"+month+"-"+day;
// var published_date = '2017-08-02'; // year+"-"+month+"-"+day;


// extract publication date
var pub_date = parseDate(published_date);
Expand Down Expand Up @@ -367,9 +368,9 @@ function PaperbuzzViz(options) {
var viz = {};

// size parameters
viz.margin = {top: 20, right: 20, bottom: 90, left: 50};
viz.width = 600 - viz.margin.left - viz.margin.right;
viz.height = 300 - viz.margin.top - viz.margin.bottom;
viz.margin = {top: 20, right: 20, bottom: 20, left: 50};
viz.width = 500 - viz.margin.left - viz.margin.right;
viz.height = 200 - viz.margin.top - viz.margin.bottom;


// div where everything goes
Expand Down Expand Up @@ -410,7 +411,11 @@ function PaperbuzzViz(options) {
viz.svg.append("g")
.attr("class", "y axis");

viz.tip = d3.tip().attr('class', 'paperbuzzTooltip').html(function(d) { return "count: " + d.count + "<br>" + "date: " + d.date; });
// TODO: change so that instead of d.date, it does something more sensible like:
// saying the name of the month (when viewing monthly) and saying day + month (in words)
// when daily. Showing year for yearly is good.
// also, style so number is in one colour?
viz.tip = d3.tip().attr('class', 'paperbuzzTooltip').html(function(d) { return d.count + "<br>" + d.date; });
viz.tip.offset([-10, 0]); // make room for the little triangle
viz.svg.call(viz.tip);

Expand Down

0 comments on commit f3387a8

Please sign in to comment.