-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.js
150 lines (129 loc) · 4.5 KB
/
main.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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
//(function(){ // make everything same namespace for now so easier
// console inspect; refactor into private / local namespaces as needed
// I checked nodeinfo for no namespace collisions
var nodedata, groupnode, flowdata = [];
var in_out_degree_at_timeslot = 1;
var total_degree = [];
var current_time_step = 0;
var controller_brusher;
var flow_id;
var array_in_out_size_of_nodes;
function start(){
flow_id = flow.ptc3_flow();
}
function stop(){
if (flow_id !== undefined) clearInterval(flow_id);
}
window.start = start;
d3.csv("data/PTC3-V.csv", function(data) {
nodedata = data.map(function(d) {
return {
label: d.label,
x: +d.xcoord,
y: +d.ycoord,
z: +d.zcoord,
area: d.area,
plot: d.plot,
time_data: new Array() // index = t, [in_degree, out_degree]
};
});
flow.init_scales();
array_in_out_size_of_nodes = function(nodes){
var x = [];
_.each(nodes, function(d){
x.push([0,0]);
});
return x;
};
loaddata()
});
// load the time data
first_run = true;
function loaddata() {
hash = location.hash;
if(hash == null || hash == "") {
hash = '95-LD';
}
perc = hash.substring(1, 3);
cond = hash.substring(4, 6);
if(perc == '50' ) {
filename = "data/F-PTC3-words-" + cond + "-E.csv";
} else {
filename = "data/F-PTC3-words" + perc + "-" + cond + "-E.csv";
}
d3.csv(filename, function(data) {
var previous_timeslot;
var degree_at_time = 0;
flowdata = [];
_.each(data, function(d) {
if(d.t == previous_timeslot) {
flowdata[flowdata.length-1].push({"source": +d.src -1, "target": +d.snk - 1})
in_out_degree_at_timeslot[+d.src-1][1]+= 1;
in_out_degree_at_timeslot[+d.snk-1][0]+= 1;
degree_at_time ++;
} else {
if (in_out_degree_at_timeslot!= 1){
// load the in_out_degree into nodedata
for( var i = 0; i<nodedata.length; i++){
nodedata[i]["time_data"].push(in_out_degree_at_timeslot[i]);
};
total_degree.push(degree_at_time);
degree_at_time = 0;
};
in_out_degree_at_timeslot = array_in_out_size_of_nodes(nodedata);
previous_timeslot = d.t;
flowdata.push([{"source": +d.src - 1, "target": +d.snk -1}]);
in_out_degree_at_timeslot[+d.src-1][1]+= 1;
in_out_degree_at_timeslot[+d.snk-1][0]+= 1;
degree_at_time ++;
}
});
total_degree.push(degree_at_time);
// Hi Chaoyu
// total_degree[t] is the total degree at that time
// it is a global variable
if(first_run) {
flow.init()
controller_brusher = graph_contoller();
first_run = false;
add_tooltips();
}
plotMatrix.init();
});
}
//})();
/*
* TODO
*
(NAME) to say I will do this
(NAME+) I will help with this
(GREG+) Writeup - Greg has refs and structure in head / from poster
Features that remain:
1. Aggregate charts for selection (on right hand side)
2. Matrix representation of graph
(GREG) Refactor to show with time
3. Visual hypothesis testing
4. Comparing two datasets ie data from nonsense vs real word
Nice to have:
1. Fix "density" issue for nodes closer together (route through center? adjust?)
2. Show inverse of the graph
3. More fully featured sensors and deriving sensors from simpler sensors (frequency filters, differences, et)
4. Comparing >2 datasets
5. Changing layout between physical and circle
Conrad's thoughts
Features to do: (Preface: Don't worry about getting it all done! Future work is acceptable)
1) Nice feature, but do this lastish
2) Great! You guys have been working on this already
3) I'll make some null models. There are a few ways to do it. I'll whiteboard it in the HCI lab tomorrow morning.
4) Great! Again, there is no one way to compare this data so I'll whiteboard it to capture a sense.
5) Persistent labels. This "shouldn't" be difficult.
Nice to have:
1) That would be cool, Jeff would appreciate it for sure, also if it is a toggle
2) I don't think that would be useful for this data, even as a comparison point. Null models will be better.
3) Cool, but sounds complicated :p Let's get to that if we have time
4) Yes! Addressed before.
5) Changing layout between circle & physical (both have drawbacks but I think it is good to have both representations).
*
* Maybe TODO
* refactor time since we're juggling between index and actual time value
*/