Doughnut Chart Maker Tool
Doughnut Chart Maker Tool
User to input the number of slices and the size of the hole in the center of the doughnut chart, a canvas element where the chart will be drawn, and it draw the chart based on the user's input.
Number input for the number of slices, and a range input for the size of the hole. The number input is set to a minimum value of 1 and is required, while the range input is set to a minimum value of 0, a maximum value of 100, and a default value of 50.
When user press the button to draw the charti it calculates the angles for each slice based on its value and the total value, and sets the size of the hole based on the user's input. It sets the starting angle to 0 and then loops through each slice, setting the fill color, calculating the end angle, and drawing the slice. Finally, sets the starting angle for the next slice to the end angle of the current slice and repeats until all slices have been drawn.