Drawing the Stacked Bars

Drawing stacked data means we should draw our bars in groups to keep things organized.

We'll cover the following

We are going to draw the stacked bars using our scales. Unlike other charts, we are going to take two steps for drawing the bars. First, we need to loop through the formatted data. The formatted data is an array of age groups. On each iteration, we will loop through the data inside the age group. For each iteration, we will draw a bar. In total, there should be 468 bars drawn on the image.

Creating groups

In the script, at the bottom of the draw() function, we will add the following code:

Get hands-on with 1200+ tech skills courses.