Im using https://www.highcharts.com/ to generate a sankey chart which expect a certain data format in order to be correctly rendered, my issue is how to parse my data and change it to the format that highchart needs.
I have this:
$data = [
[ 'Brazil', 'Portugal', 'Spain' ],
[ 'Brazil', 'Portugal', 'Spain' ],
[ 'Brazil', 'Portugal' ],
[ 'Brazil', 'Portugal', 'France' ],
[ 'Brazil', 'Portugal', 'Germany' ],
[ 'Brazil', 'Portugal', 'Spain' ]
];
And i need this:
$data = [
[ 'Brazil', 'Portugal', 6 ],
[ 'Portugal', 'Spain', 3 ],
[ 'Portugal', 'France', 1 ],
[ 'Portugal', 'Germany', 1 ]
];
I dont know to exactly how i can do this, i guess i have to loop and parse them but im out of ideias, sorry for not having anything that i can show that i tried.