|
@ -1,5 +1,6 @@ |
|
|
|
|
|
|
|
|
function draw_roulette(nb_person, x, y, r, names){ |
|
|
function draw_roulette(nb_person, x, y, r, 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 = starting_coo; |
|
@ -12,8 +13,12 @@ function draw_roulette(nb_person, x, y, r, names){ |
|
|
new_path.setAttribute('d', "M " + starting_coo[0] + " " + starting_coo[1] + " A " + r + " " + r + " 0 0 1 " + coo_arr[0] + " " + coo_arr[1] + " L " + center[0] + " " + center[1] + " Z"); |
|
|
new_path.setAttribute('d', "M " + starting_coo[0] + " " + starting_coo[1] + " A " + r + " " + r + " 0 0 1 " + coo_arr[0] + " " + coo_arr[1] + " L " + center[0] + " " + center[1] + " Z"); |
|
|
|
|
|
|
|
|
let text = document.createElement("text"); |
|
|
let text = document.createElement("text"); |
|
|
text.innerTEXT = names[i]; |
|
|
text.innerText = names[i]; |
|
|
text.setAttribute("transform", "rotate("+(-360)/nb_person+", "+center[0]+", "+center[1]+")"); |
|
|
text.setAttribute("x", text_coo[0]); |
|
|
|
|
|
text.setAttribute("y", text_coo[1]); |
|
|
|
|
|
text.setAttribute("lengthAdjust", "spacing"); |
|
|
|
|
|
text.setAttribute("stroke-width", "1"); |
|
|
|
|
|
text.setAttribute("transform", "rotate("+(360)/nb_person*(i+0.5)+", "+center[0]+", "+center[1]+")"); |
|
|
|
|
|
|
|
|
chart.appendChild(new_path); |
|
|
chart.appendChild(new_path); |
|
|
chart.appendChild(text); |
|
|
chart.appendChild(text); |
|
|