let chartData;
function setChartData(label, key, legendOrder, color, footNoteCode) {
return {
label, key, legendOrder, color, footNoteCode,
};
}
const chartInfo = [
['Match Day', 'matchdayValue', 0, 4, 4],
['Broadcasting', 'broadcastingValue', 1, 2, 5],
['Commercial', 'commercialValue', 2, 1, 6],
['Brand', 'brandValue', 3, 3, 7],
];
const chartInfo2 = [
['Brand', 'brandManagementValue', 3, 4, 12],
['Market', 'marketValue', 1, 2, 10],
['Sport', 'sportsValue', 0, 1, 9],
['Stadium', 'stadiumValue', 2, 3, 11],
];
if (numbersData.pieChart.matchdayValue) {
chartData = chartInfo.map((el) =>
setChartData(el[0], el[1], el[2], el[3], el[4]));
} else {
chartData = chartInfo2.map((el) =>
setChartData(el[0], el[1], el[2], el[3], el[4]));
}