0
I have the following array, and I need to convert it for Highcharts to interpret and generate the chart, as I can iterate my array, since it returns the duplicate region but with different sale value?
Where the X axis would be [nomcin], the name would be [nomreg] and date would be an array with [valven], follows 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
And I’d like my chart to stay that way:
The chart will show sales by Region, and rating a given year.
Hello @wribeiro , sorry let me see if I got it right, your difficulty is in relation to the duplicity of the region, as for example the SC that appears twice this? If yes, you can do a GROUP BY on sql to resolve...
– Neo
@Neo I will edit the question, with some prints for better understanding
– wribeiro