You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
d3.select(`svg.${my_class}`).attr("height",h);// set height in html
24
+
letr:number=w/2-R-10;// radius of graph
25
+
letphi_0:number=0;// phi 0
26
+
letphi_i:number=phi_0;// phi i
27
+
letx_0:number=w/2;// x 0
28
+
lety_0:number=h/2;// y 0
29
+
letx:number[]=[];
30
+
lety:number[]=[];
31
+
for(leti=0;i<graph.vertices.length;i++){
32
+
phi_i+=360/n;
33
+
x[i]=x_0-r*Math.sin(Math.PI*(2+phi_i/180));
34
+
y[i]=y_0+r*Math.cos(Math.PI*(2+phi_i/180));
35
+
36
+
}
37
+
leti=0;
38
+
letj=0;
39
+
letvert_names:string[]=[];
40
+
graph.vertices.forEach((v:IVertex)=>{
41
+
vert_names[j]=v.name;
42
+
j++;
43
+
});
44
+
graph.edges.forEach((e:IEdge)=>{
45
+
//let z = Math.min(parseInt(d3.select(`svg.${my_class}`).select(`svg.vert_num_${e.vertexOne.name}`).style("z")),parseInt(d3.select(`svg.${my_class}`).select(`svg.vert_num_${e.vertexTwo.name}`).style("z")));
d3.select(`svg.${my_class}`).select(`svg.vert_num_${v.name}`).append(`text`).attr("x",x[i]).attr("y",y[i]+4)// знак = 8 пикселей в высоту, поэтому ловим середину так сказать(
0 commit comments