diff --git a/index.php b/index.php index dcb4fce..9668e6d 100755 --- a/index.php +++ b/index.php @@ -16,13 +16,9 @@ var_dump($res); ?> - + diff --git a/script.js b/script.js index 7c279e2..f8baf63 100755 --- a/script.js +++ b/script.js @@ -1,21 +1,14 @@ -function draw_roulette(ctx, w, h, datalist){ - var radius = h / 2 - 5; - var center = new Array(w / 2, h / 2); - var init = 0; - var total = datalist.reduce((acc, value) => acc + value, init); - var lastend = 0; - var offset = Math.PI / 2; - for (i=0; i < datalist.length; i++){ - var part = datalist[i]; - ctx.beginPath(); - ctx.fillStyle = colist[i]; - ctx.moveTo(center[0], center[1]); - var arcsector = Math.PI * (2 * part / total); - ctx.arc(center[0], center[1], radius, lastend - offset, lastend + arcsector - offset, false); - ctx.lineTo(center[0], center[1]); - ctx.fill(); - ctx.closePath(); - lastend += arcsector; +function draw_roulette(nb_person, x, y){ + let chart = document.getElementById("roulette") + let angle = 0; + for (let i=0; i < 1; i++){ + let coo_arr = new Array(250 - 50 * Math.cos(2 * Math.PI / nb_person), 200 - 50 * Math.sin(2 * Math.PI / nb_person)); + let new_path = document.createElement("path"); + new_path.setAttribute('fill', 'green'); + new_path.setAttribute('d', "M 200 200 A 50 50 0 0 1 " + coo_arr[0] + " " + coo_arr[1] + " L 250 200 Z"); + chart.appendChild(new_path); + console.log(new_path.getAttribute('d')); } -} +}; +