-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplots.js
43 lines (36 loc) · 1.12 KB
/
plots.js
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
function init() {
var selector = d3.select("#selDataset");
d3.json("samples.json").then((data) => {
console.log(data);
var sampleNames = data.names;
sampleNames.forEach((sample) => {
selector
.append("option")
.text(sample)
.property("value", sample);
});
})}
init();
function optionChanged(newSample) {
//console.log(newSample);
buildMetadata(newSample);
buildCharts(newSample);
}
function buildMetadata(sample) {
d3.json("samples.json").then((data) => {
var metadata = data.metadata;
var resultArray = metadata.filter(sampleObj => sampleObj.id == sample);
var result = resultArray[0];
var PANEL = d3.select("#sample-metadata");
PANEL.html("");
PANEL.append("h6").text("ID: " + result.id);
PANEL.append("h6").text("ETHINICITY: " + result.ethnicity);
PANEL.append("h6").text("GENDER: " + result.gender);
PANEL.append("h6").text("AGE: " + result.age);
PANEL.append("h6").text("LOCATION: " + result.location);
PANEL.append("h6").text("BBTYPE: " + result.bbtype);
PANEL.append("h6").text("WFREQ: " + result.wfreq);
});
}
function buildCharts(newSample) {
}