Browse Source

3.1415926535897932384626433832

master
quegzacov 2 years ago
parent
commit
b5fb6d906c
  1. 6
      script.js

6
script.js

@ -3,7 +3,7 @@ function draw_roulette(nb_person, x, y, r, names){
console.log(names); console.log(names);
let chart = document.getElementById("roulette").querySelector('g'); let chart = document.getElementById("roulette").querySelector('g');
let starting_coo = new Array(x, y + r); let starting_coo = new Array(x, y + r);
let text_coo = starting_coo; let text_coo = new Array(starting_coo[0] + (r/2), starting_coo[1]);
let center = new Array(x + r, y + r); let center = new Array(x + r, y + r);
let angle = 0; let angle = 0;
for (let i=0; i < nb_person; i++){ for (let i=0; i < nb_person; i++){
@ -16,7 +16,9 @@ function draw_roulette(nb_person, x, y, r, names){
text.innerText = names[i]; text.innerText = names[i];
text.setAttribute("x", text_coo[0]); text.setAttribute("x", text_coo[0]);
text.setAttribute("y", text_coo[1]); text.setAttribute("y", text_coo[1]);
text.setAttribute("lengthAdjust", "spacing"); text.setAttribute("textLength", r/2);
text.setAttribute('text-anchor', 'middle');
text.setAttribute("font-size", r/5)
text.setAttribute("stroke-width", "1"); text.setAttribute("stroke-width", "1");
text.setAttribute("transform", "rotate("+(360)/nb_person*(i+0.5)+", "+center[0]+", "+center[1]+")"); text.setAttribute("transform", "rotate("+(360)/nb_person*(i+0.5)+", "+center[0]+", "+center[1]+")");

Loading…
Cancel
Save