Skip to content

Commit

Permalink
Added ability to load demo files directly
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinke Hoekstra committed Dec 20, 2013
1 parent d67db7c commit cf7cdb7
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
<span class="btn btn-lg btn-primary btn-file">
Select files to display... <input type="file" id="fileinput" multiple/>
</span>

<span id="demos">
</span>
<!-- <label for="datasetSelector">Select Dataset</label>
<select id="datasetSelector" name="dataset" class="form-control">
<option selected value="none">Please select a dataset</option>
Expand Down
55 changes: 54 additions & 1 deletion js/patents.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ var currentyear;

var years = [];

var demos = {uspto: {description: 'USPTO CuInSe2', start: 1974, end: 2008, url: 'http://semweb.cs.vu.nl:/patents2/ztest/', prefix: 'z' }}




var colors = {};

var filedict = {};
Expand Down Expand Up @@ -45,6 +50,8 @@ $(function () {
setup_reader(files, 0);
});



// $("#slider").slider();

$("#play").hide();
Expand All @@ -68,15 +75,61 @@ $(function () {
});


console.log("Initializing...");
for (d in demos){
console.log(d);
demo = demos[d];

var demo_button = $('<div>'+demo.description+'</div>');
demo_button.addClass('btn btn-info btn-lg');

demo_button.on('click', function(e){
// Reset the years array
years = [];
// Reset the file dictionary
filedict = {};

get_from_server(demo,demo.start);
});

$('#demos').append(demo_button);
}

console.log("Initializing...");
});

// $(document).ready(function(){
// $("#results").tablesorter();
// });


function get_from_server(demo, y){
var url = demo.url + demo.prefix + y + ".txt";

$.get(url, function(data){
filedict[y] = data;
years.push(y)

if (y <= demo.end){
get_from_server(demo, y+1);
} else {
years.sort();
initialize(years, filedict);
}

}).fail(function(){
if (y <= demo.end){
get_from_server(demo, y+1);
} else {
years.sort();
initialize(years, filedict);
}

});


}


function setup_reader(files, i) {
// Get the file details
var file = files[i];
Expand Down

0 comments on commit cf7cdb7

Please sign in to comment.