I have a page with a pie chart (canvas 2d) which uses js function to create. With the function, I can then in html input some values to draw the pie chart. It simply looks like this in codes
<script id="chart">
piechart("piechart1", ["cyan", "yellow", "green"], [ 75, 75, 75]);
</script>
Which means I can input fixed colors/angles for my chart. What I'm trying to do is trying to make a few text input area so I can input numbers and either the script can automatically change to the number being input or using a submit button.
This is all I have at the moment can someone give me a hand with this?
<canvas id="piechart1"></canvas>
<script id="chart">
piechart("piechart1", ["cyan", "yellow", "green"], [ 75, 75, 75]);
</script>
<form action="" method="post">
<label>Angle 1</label>
<label>Angle 2</label>
<label>Angle 3</label>
<br>
<input name="" id="angle1" value="" type="number">
<input name="" id="angle2" value="" type="number">
<input name="" id="angle3" value="" type="number">
<input type="submit" id="submitBtn" value="submit">
</form>
So let's say if I input 100 into the first text area and click submit then my
piechart("..........[ 75, 75, 75]); would change to
piechart("..........[ 100, 75, 75]);
or
piechart("..........[ 100, 0, 0]);since I didn't input anything into the 2nd and 3rd text area
Thanks in advance.