I am trying to achieve this kind of chart (column chart)

but I can't seem to group my data correctly, Please help. Here's my sample json data.
[
[
'male',
'05-09'
],
[
'female',
'05-09'
],
[
'male',
'05-09'
],
]
and I am creating my datatable using
function createDataTable(rawData, $tableHeader) {
try {
return google.visualization.arrayToDataTable([
$tableHeader,
...rawData
]);
} catch (e) {
return null;
}
}
Then here's how I am grouping it currently
function groupData(columnIndex) {
return google.visualization.data.group(data, [columnIndex], [{
'column': columnIndex,
'aggregation': google.visualization.data.count,
'type': 'number'
}])
}
Here's how I draw the chart
function drawBarChart() {
let ageData = groupData(1);
let options = {
title: '',
width: '810',
height: '500',
chartArea: {width: '50%'},
colors: ['#FF7300', '#383A38', '#FFC799'],
hAxis: {
title: 'Age Groups',
minValue: 0
},
vAxis: {
title: 'Hits'
},
orientation: 'horizontal',
legend: { position: 'none' }
};
let chart = new google.visualization.BarChart(document.getElementById('age-graph'));
chart.draw(ageData, options);
}
Thank you so much!