Skip to content

Commit

Permalink
Merge pull request #1 from dustismo/debugging
Browse files Browse the repository at this point in the history
Add options
  • Loading branch information
norlab authored Feb 18, 2018
2 parents f307906 + b528ece commit 68b3fc3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
31 changes: 26 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,32 @@ <h1>Paperbuzz Visualizations</h1>
<script type="text/javascript" src="script6.js"></script>

<script type="text/javascript">

d3.json("https://api.paperbuzz.org/v0/doi/10.1371/journal.pmed.0020124", function(d) {
paperbuzzStatsJson = d;
paperbuzz.initViz();
});
options = {
baseUrl: 'http://pkp-alm.lib.sfu.ca',
minItemsToShowGraph: {
minEventsForYearly: 6,
minEventsForMonthly: 6,
minEventsForDaily: 6,
minYearsForYearly: 6,
minMonthsForMonthly: 6,
minDaysForDaily: 6
},
showTitle: true,

}

d3.json('https://api.paperbuzz.org/v0/doi/10.1371/journal.pone.0000308', function(d) {
options.paperbuzzStatsJson = d
// var paperbuzz = new PaperbuzzViz(options);
paperbuzz.initViz(options);
});



// d3.json("https://api.paperbuzz.org/v0/doi/10.1371/journal.pmed.0020124", function(d) {
// paperbuzzStatsJson = d;
// paperbuzz.initViz();
// });
</script>
<div id="built-with"><p>Built with <a href="http://d3js.org/">d3.js</a></p></div>
</body>
Expand Down
17 changes: 12 additions & 5 deletions script6.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
paperbuzz.initViz = function() {
var paperbuzz = {}

paperbuzz.initViz = function(options) {
console.log("IM here")
console.log(options)
console.log(window.innerWidth);

var d = paperbuzzStatsJson;
var d = options.paperbuzzStatsJson;
var parseDate = d3.timeParse('%Y-%m-%d');

var vizDiv = d3.select("#paperbuzz");
Expand Down Expand Up @@ -143,7 +147,12 @@ paperbuzz.initViz = function() {

var xAxis = d3.axisBottom(x);

var svg = d3.select('#paperbuzz').append('svg')
var graphContainer = d3.select('#paperbuzz').append('div');
graphContainer.attr("class", "alm-category-row")
.attr("style", "width: 100%; overflow: hidden;")
.attr("id", "category-" + a);

var svg = graphContainer.append('svg')
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom);

Expand Down Expand Up @@ -199,6 +208,4 @@ paperbuzz.initViz = function() {
.text("Date");

a++;}


};

0 comments on commit 68b3fc3

Please sign in to comment.