0
I am using Highchart to create charts, however I am not able to pass the value of data
through a php variable:
series: [{
name: 'Tendência',
data: <?php echo $encodeValorTendencia; ?>
},{
name: 'Obtenção',
data: <?php echo $encodeValorObtencao; ?>
}],
I’m already "bumping" the variables:
$valorTendencia[] = $value->Valor;
$encodeValorTendencia = json_encode($valorTendencia);
$valorObtencao[] = $value->ValorObtencao;
$encodeValorObtencao = json_encode($valorObtencao);
$dataHora[] = $value->DataHoraPrevisao;
$encodeDataHora = json_encode($dataHora);
The value of the variable $dataHora
works, through this stretch:
xAxis: {
categories: <?php echo $encodeDataHora; ?>
},
This way the graph appears with the date and time but the values of series do not.
Try to var_dump the variables outside of
<script></script>
and see if the values are OK.– Guilherme Nascimento
I showed(var_dump) the $encodeValue variable and printed this: string '["2000","2000","2000","700","800","700","2000","2000","2000","2000","2000""]'
– Jonathan de Toni