-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathhighlight.js
188 lines (133 loc) · 4.32 KB
/
highlight.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
function mouseoverColumn(d,i){
var combinedSets = usedSets.map(function(dd,ii){
return (dd.id== d.id)?1:0
})
mouseoverColumnImpl(combinedSets);
}
function mouseoverColumnImpl(combinedSets) {
d3.selectAll(".connection, .combination rect, .setSize")
// .style("opacity", .3)
.style("stroke", "white")
d3.selectAll(".connection.diagonal").filter(function (dd, ii) {
return combinedSets[ii];
// return dd.id== d.id;
})
.style("opacity", 1)
.style("stroke", "black")
// d3.selectAll(".combination").selectAll("rect").filter(function (dd, ii) {
// return combinedSets[ii];
//// return dd.id== d.id;
// })
// .style("opacity", 1)
// .style("stroke", ctx.backHighlightColor)
// d3.selectAll(".setSize").filter(function (dd, ii) {
// return combinedSets[ii];
//// return dd.id== d.id;
// })
// .style("opacity", 1)
// .style("stroke", "black")
d3.selectAll(".setSizeBackground").filter(function (dd, ii) {
return combinedSets[ii];
// return dd.id== d.id;
})
.style("opacity", 1)
.style("fill", ctx.backHighlightColor)
d3.selectAll(".connection.vertical").filter(function (dd, ii) {
return combinedSets[ii];
// return dd.id== d.id;
})
.style("opacity", 1)
// .style("stroke", "black")
.style("fill",ctx.backHighlightColor)
ctx.columnBackgroundNode.selectAll(".columnBackground").style({
opacity:function(dd,i){
var value = combinedSets[i];
switch (value){
case 2:
return 0; break;
default:
return value;
}
}
})
}
function mouseoutColumn() {
d3.selectAll(".connection, .combination rect")
.style("opacity", 1)
.style("stroke", "none")
d3.selectAll((".setSizeBackground")).style({
"stroke": "none",
"fill":ctx.grays[0]
})
ctx.tableHeaderNode.selectAll(".connection")
.style("fill", ctx.grays[0])
ctx.columnBackgroundNode.selectAll(".columnBackground").style({
opacity:0,
stroke:"none"
})
}
function mouseoverRow(d,i){
mouseoverRowImpl(d, d.data.combinedSets);
}
function mouseoverRowImpl(d, combinedSets) {
// plot Venn diagram with highlighting of selected subset
if ( d.data.type === 'SUBSET_TYPE') {
if ( usedSets.length === 2 || usedSets.length === 3 ) {
venn.plot( [ d.data ], usedSets.length );
}
}
if ( d.data.type === 'GROUP_TYPE') {
if ( usedSets.length === 2 || usedSets.length === 3 ) {
venn.plot( d.data.subSets, usedSets.length );
}
}
d3.selectAll(".row .backgroundRect")
.style({
"stroke":function(dd){
if (d.id == dd.id) return "black";
else null;
},
"fill-opacity":function(dd){
if (d.id == dd.id) return .7;
else return 0.001;
}
})
// mouseoverColumn(d.data.combinedSets)
mouseoverColumnImpl(combinedSets)
}
function mouseoutRow() {
// plot Venn diagram without highlighting
venn.plot(null, usedSets.length );
d3.selectAll(".row .backgroundRect")
.style({"stroke":null,
"fill-opacity":0
})
mouseoutColumn();
}
function mouseoverCell(rowData, columnIndex) {
var combinedSets = rowData.data.combinedSets.map(function(d,i){
if (i==columnIndex) return 1;
else return d;
})
mouseoverRowImpl(rowData, combinedSets)
var columnBackgrounds = ctx.columnBackgroundNode.selectAll(".columnBackground").style({
stroke:function(dd,i){if (i==columnIndex) return 1; else return "none"}
})
d3.selectAll(".setSize").style({
stroke:function(dd,i){if (i==columnIndex) return "black"; else return "white"}
})
// .style("opacity", 1)
// .style("fill", ctx.backHighlightColor)
//
d3.selectAll(".connection.vertical")
.style("stroke",function(d,i){
return (i==columnIndex)?"black":"none";
})
// columnBackgrounds.filter(function(d,i){return i==columnIndex})
// .style({
// opacity:1
// })
}
function mouseoutCell() {
mouseoutRow()
}