Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options #1

Merged
merged 1 commit into from
Feb 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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++;}


};