yearLabels.forEach((year, yearIndex) => {
let xPosition = (barDistance * yearIndex) + graphLeft,
localHeight = 0;
categoryLabels.forEach((category, categoryIndex) => {
let categoryItem = yearData[year][categoryIndex],
crimeHeight = categoryItem * singleCrimeHeight,
localSaturation = 30 + ((50 / categoryLabels.length) * categoryIndex),
localColor = categoryIndex % 2;
localHeight += crimeHeight;
scrawl.makeBlock({
name: `${namespace}-${year}-${category}`,
group: group,
width: barWidth,
height: `${crimeHeight}%`,
startX: `${xPosition}%`,
startY: `${graphBottom - localHeight}%`,
lineWidth: 6,
strokeStyle: 'yellow',
fillStyle: `hsla(${localColor ? 243 : 0}, 100%, ${localSaturation}%, 1)`,
method: 'fill',
onEnter: function () {
group.setArtefacts({
method: 'fill',
order: 0,
});
this.set({
method: 'fillThenDraw',
order: 1,
});