propertyOffencesData = TotalOffenceList .flatMap(d => {
return Object.keys(d).filter(key => key !== 'CRIMINAL CODE OFFENCES').map(year => {
let count = d[year];
if (typeof count === 'string') {
count = count.replace(/,/g, '');
}
return {
Year: year,
Offence: d['CRIMINAL CODE OFFENCES'],
Count: +count
};
});
});