-
Notifications
You must be signed in to change notification settings - Fork 0
/
packages.html
83 lines (83 loc) · 3.22 KB
/
packages.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Packages that use a given instruction</title>
<link crossorigin="anonymous" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
<link crossorigin="anonymous" href="https://bootswatch.com/3/lumen/bootstrap.css" rel="stylesheet" type="text/css" />
<link crossorigin="anonymous" href="main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container-fluid">
<div class="fluid-row">
<div class="col-xs-12">
<h2>
<center>
List of packages that use <span id="instruction"></span>
</center>
</h2>
</div>
<div class="col-xs-8 col-xs-offset-2">
<table id="package-table" class="table table-bordered table-striped">
<thead>
<tr>
<th>Packge_name</th>
<th>Rank</th>
<th>No. of Installations</th>
</tr>
</thead>
<!-- <tfoot>
<tr>Packge_name</tr>
<tr>Rank</tr>
<tr>No. of Installations</tr>
</tfoot> -->
</table>
</div>
</div>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crossfilter/1.3.12/crossfilter.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dc/2.0.0-beta.32/dc.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// Parse the inputs
var parameters = location.search.substring(1).split("&");
// var temp = parameters[0].split("=");
var id = unescape((parameters[0].split("="))[1]);
var mnem = unescape((parameters[1].split("="))[1]);
var prefix = unescape((parameters[2].split("="))[1]);
var opcode = unescape((parameters[3].split("="))[1]);
var size = unescape((parameters[4].split("="))[1]);
document.getElementById("instruction").innerHTML = mnem + " (" + prefix + ", " + opcode + ", " + size + ")";
d3.json('packages/'+id+".json", function(data) {
var tableData = data.packages;
_.forEach(tableData, function(d) {
d.rank = +d.rank;
d.installation_count = +d.installation_count;
});
var ndx = crossfilter(tableData);
var tblDim = ndx.dimension(function(d) {return d;})
var packageTable = dc.dataTable('#package-table');
packageTable
.dimension(tblDim)
.group(function (d) { return 'dc.js insists on putting a row here so I remove it using JS'; })
.columns([
function(d) {return d.name;},
function(d) {return d.rank;},
function(d) {return d.installation_count;}
])
.sortBy(dc.pluck('rank'))
.order(d3.ascending)
.on('renderlet', function (table) {
// each time table is rendered remove nasty extra row dc.js insists on adding
table.select('tr.dc-table-group').remove();
})
.size(Infinity);
dc.renderAll();
})
} );
</script>
</body>
</html>