68ee970d
Renato De Donato
jsdatachecker
|
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
|
<html>
<head>
<script type="text/javascript" src="../ArrayUtils.js"></script>
<script type="text/javascript" src="../DataTypesUtils.js"></script>
<script type="text/javascript" src="chartviz.js"></script>
</head>
<body>
<h3>Dataset Visualizer</h3>
Dataset URL: <input id="txtDatasetUrl" type="text" style="width: 75%;"
value="http://ckan.routetopa.eu/dataset/fce7b89c-4c36-47c4-a486-7df5307a884e/resource/1b675fb7-8c9a-46d0-8f80-3e28afe4f4b5/download/litterwardennonulls.csv">
<input id="btnLoad" type="button" value="Load dataset" onclick="btnLoad_OnClick();">
<br/>
<br>
<table border=1>
<thead>
<tr id="trHeader">
</tr>
<tr id="trHeaderType">
</tr>
</thead>
<tbody>
</tbody>
</table>
<script type="text/javascript">
window.onload = function() {
//var chartProcessor = new ChartProcessor();
//chartProcessor.inferDataTypes(urllnk);
}//EndFunction.
function btnLoad_OnClick() {
//Take the url from the input text.
var valDatasetUrl = document.getElementById('txtDatasetUrl').value;
var chartProcessor = new ChartProcessor();
chartProcessor.inferDataTypes(valDatasetUrl, update);
}//EndFunction.
function update(fields) {
console.log("update function.");
var trHeader = document.getElementById('trHeader');
for (var i=0;i<fields.length; i++) {
var field = fields[i];
var ntd = document.createElement("th");
ntd.innerHTML = field.name;
trHeader.appendChild(ntd);
}//EndFor.
var trHeaderType = document.getElementById('trHeaderType');
for (var i=0;i<fields.length; i++) {
var field = fields[i];
var ntd = document.createElement("th");
ntd.innerHTML = field.type + " (" + Math.round(field.typeConfidence * 100) + "%)";
trHeaderType.appendChild(ntd);
}//EndFor.
}//EndFunction.
</script>
</body>
</html>
|