forked from e-/Multiclass-Density-Maps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser.html
50 lines (49 loc) · 1.84 KB
/
parser.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
<!doctype html>
<html>
<head>
<title>Scalable Rendering of Multiclass Density Maps Parser</title>
</head>
<body>
<h1>Rendition</h1>
<canvas id="canvas"></canvas>
<script src="https://d3js.org/d3-dsv.v1.min.js"></script>
<script src="https://d3js.org/d3-fetch.v1.min.js"></script>
<script src="dist/bundle.js" type="text/javascript"></script>
<script>
let testMain = new MCS.TestMain(), configuration;
prefix = "data/";
console.log('Loading '+'census_data.json');
d3.json(prefix+"census_data.json")
.then(function(json) {
configuration = testMain.parse(json);
if (configuration != null)
configuration.parse();
return configuration;
})
.then(function(configuration) {
if (configuration.data.url) {
console.log('Loading '+configuration.data.url);
return d3.json(prefix+configuration.data.url);
}
return null;
})
.then(function(json) {
if (json == null) return;
configuration.resolve_data_url(json);
var data = configuration.data;
if (! data) return;
var buffers = data.data.buffers;
for (var i = 0; i < buffers.length; i++) {
var buffer = buffers[i];
if (! buffer.data) {
console.log('Loading '+buffer.url);
d3.json(prefix+buffer.url)
.then(function(json) {
data.data.resolve_buffer_url(buffer, json);
});
}
}
});
</script>
</body>
</html>