Skip to content

Commit e3bcc5a

Browse files
committed
avancement de la légende, bug sur semio des liens/noeuds
1 parent 65a0853 commit e3bcc5a

4 files changed

Lines changed: 241 additions & 40 deletions

File tree

assets/css/control.css

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ nav {
163163
bottom: 0;
164164
width: 70%;
165165
height: 35%;
166-
background: blue;
166+
background: rgba(128, 128, 179, 0.397);
167167
z-index: 50;
168168
display: flex;
169169
align-items: center;
@@ -173,14 +173,15 @@ nav {
173173
display: flex;
174174
align-items: center;
175175
justify-content: center;
176-
background-color: brown;
176+
177177
width: 50%;
178178
height: 100%;
179179
}
180180
.legendSubSubContainer {
181181
width: 50%;
182-
height: 100%;
183-
background: cornflowerblue;
182+
height: 92%;
183+
margin-bottom: 7%;
184+
184185
display: flex;
185186
flex-direction: row;
186187
justify-content: end;
@@ -196,14 +197,15 @@ nav {
196197
}
197198
.colorAndLabel {
198199
width: 100%;
200+
height: 12%;
199201
display: flex;
200202
align-items: flex-end;
201203
}
202204
.legendColorLabel {
203205
width: 50%;
204206
height: 100%;
205207
text-align: center;
206-
font-size: 60%;
208+
font-size: 80%;
207209
justify-content: center;
208210
display: flex;
209211
align-items: center;
@@ -216,6 +218,20 @@ nav {
216218
flex-direction: column;
217219
justify-content: space-between;
218220
}
221+
.legendSizeRamp {
222+
display: flex;
223+
height: 72%;
224+
}
225+
226+
.legendCircles {
227+
width: 100%;
228+
display: flex;
229+
flex-direction: column;
230+
}
231+
.circleAndLabel {
232+
width: 100%;
233+
display: flex;
234+
}
219235
chart {
220236
display: inline-block;
221237
height: 151px;

assets/js/olrenderer.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export default class OlRenderer {
6262
multiWorld: false,
6363
}),
6464
});
65-
console.log(this.map);
6665

6766
this._extent_size = 10000000;
6867
this._node_scale_types = { size: "Sqrt", opacity: "Linear" };
@@ -174,6 +173,9 @@ export default class OlRenderer {
174173
hex_opacity = "00";
175174
} else {
176175
hex_opacity = Math.floor(opacity * 255).toString(16);
176+
if (hex_opacity.length === 1) {
177+
hex_opacity = "0" + hex_opacity;
178+
}
177179
}
178180

179181
return color + hex_opacity;
@@ -185,6 +187,10 @@ export default class OlRenderer {
185187
opacity = Math.round(nstyle.opacity.fixed * 100) / 100;
186188
} else if (nstyle.opacity.mode === "varied") {
187189
opacity = Math.round(this.nodeOpacityScale(node) * 100) / 100;
190+
//As log(0) = -Infinity, we affect zero in this case
191+
if (opacity === -Infinity) {
192+
opacity = 0;
193+
}
188194
}
189195

190196
//COLOR
@@ -247,7 +253,9 @@ export default class OlRenderer {
247253
}
248254
nodeOpacityScale(node) {
249255
//We need to round the number
250-
return this._scale_node_opacity(+node.properties[this._node_var.opacity]);
256+
var node_value = node.properties[this._node_var.opacity];
257+
258+
return this._scale_node_opacity(node_value);
251259
}
252260

253261
//Creates color groups according to qualitative variable
@@ -508,7 +516,6 @@ export default class OlRenderer {
508516
[min_opa, max_opa] = this.handle_log_scale_opacity_range(
509517
min_opa,
510518
max_opa,
511-
false,
512519
"#semioNodes"
513520
);
514521
} else if (
@@ -521,10 +528,12 @@ export default class OlRenderer {
521528
true,
522529
"#semioNodes"
523530
);
531+
if ([min_size, max_size] === false) {
532+
return;
533+
}
524534
[min_opa, max_opa] = this.handle_log_scale_opacity_range(
525535
min_opa,
526536
max_opa,
527-
false,
528537
"#semioNodes"
529538
);
530539
}
@@ -575,6 +584,7 @@ export default class OlRenderer {
575584
alert(
576585
"Size : Can't use logarithmic scale with this data (range must not intersect 0)"
577586
);
587+
return false;
578588
} else {
579589
if (do_not_close === false) $(modal_id).modal("hide");
580590
}
@@ -643,6 +653,9 @@ export default class OlRenderer {
643653
opacity = Math.round(lstyle.opacity.fixed * 100) / 100;
644654
} else if (lstyle.opacity.mode === "varied") {
645655
opacity = Math.round(this.linkOpacityScale(link) * 100) / 100;
656+
if (opacity === -Infinity) {
657+
opacity = 0;
658+
}
646659
}
647660

648661
//COLOR
@@ -738,7 +751,6 @@ export default class OlRenderer {
738751
//Nombre de couleurs (7.99 car ayant 8 couleurs, l'indice finale ne doit pas dépasser 7)
739752
.range([0, 7.99])
740753
.domain([min_count, max_count]);
741-
console.log(min_count, max_count);
742754

743755
//SIZE
744756

@@ -811,9 +823,9 @@ export default class OlRenderer {
811823

812824
create_arrows(links, lstyle) {
813825
var nodes_hash = this.proj_nodes_hash;
826+
console.log(nodes_hash);
814827
let orientation = lstyle.shape.orientation;
815828
let shape_type = lstyle.shape.type;
816-
console.log(orientation, shape_type);
817829

818830
let style = {
819831
geometry: {

assets/js/view.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ export default class View {
214214
nodes={nodes}
215215
lstyle={lstyle}
216216
links={links}
217+
nodes_hash={this.renderer.proj_nodes_hash}
217218
/>,
218219
document.getElementById("legendDiv")
219220
);

0 commit comments

Comments
 (0)