1
I made a query with php and am iterating with my array using Foreach to set in Highcharts
the values as follows:
series: [<?php $i =0;
foreach($result as $rs) { ?>{
name: '<?php echo $rs['ConteudoNome'];?>',
data: [ <?php echo $rs['TreinoTempo']; ?>]
},<?php } ?>
And the result is like this:
series: [{
name: 'Corrida',
data: [ 60]
},{
name: 'Ataque',
data: [ 51]
},{
name: 'Corrida',
data: [ 50]
},
]
I need the result to be something like "Race" [60.50]
that is, when the ConteudoNome
is equal, it just adds the value and does not create another series.
I followed your advice, however when I will pass my array already in JSON format to JS, it is not right. I gave an Alert and it gets Object Object; you know what it can be?
– LMaker
@Luangabriel gives a console.log(seuarray) and sees how his array is using F12->console.
– Marconi
Ae, in the console.log the array appeared ok, however it is not mounting on the chart.
– LMaker
@Luangabriel imported highchats.js and Jquery.js? Note that Jquery comes before.
– Marconi
I did, I think the problem is in the "series: result". I already tried unsuccessfully to do this a few days ago to play a direct JSON array in the series
– LMaker
I don’t think that’s it, because the code above is working. Click
Executar trecho de código
and you’ll see. I think you’re missing some detail in adapting that code to your.– Marconi
Join the chat so we can be careless about it. continue this discussion on chat](http://chat.stackexchange.com/rooms/32104/discussion-between-marconi-and-luan-gabriel).
– Marconi