I have the following array, and I need to convert it to Highcharts interpret and generate the graph, how can I iterate my array, since it returns the duplicate region but with different sale value?
Where the X-axis would be [name], the name would be [nomreg] and date would be an array with [valven], follow Highcharts format, and array returned by PHP:
xAxis: {
categories: ['Outros', 'Peças', 'Tratores'],
crosshair: true
}
series: [{
name: 'PR',
data: [
49.9, 71.5, 500
]
}, {
name: 'SC',
data: [
83.6, 78.8, 63
]
}]
Array (
[0] => stdClass Object
(
[anomes] => 201601
[codreg] => 41
[nomreg] => PR
[codcin] => 1
[nomcin] => OUTROS
[valven] => 6835.7000
[qtdven] => 1078.8000
)
[1] => stdClass Object
(
[anomes] => 201601
[codreg] => 42
[nomreg] => SC
[codcin] => 1
[nomcin] => OUTROS
[valven] => 3129.0000
[qtdven] => 366.6200
)
[2] => stdClass Object
(
[anomes] => 201601
[codreg] => 42
[nomreg] => SC
[codcin] => 2
[nomcin] => PECAS
[valven] => 346.9100
[qtdven] => 73.6600
)
)
SQL result:
anomes codreg nomreg codcin nomcin valven qtdven
------ ------ ------ ------ ------ --------- -----------
201601 41 PR 1 OUTROS 6835.7000 1078.8000
201601 42 SC 1 OUTROS 3129.0000 366.6200
201601 42 SC 2 PECAS 346.9100 73.6600
AndIwouldlikemycharttolooklikethis:
The chart will show sales by Region, and rank for a given year.