-1
I’m having trouble generating charts using data from the bank.
I have a query in the database that generates an array as a result. (Follow below)
<?php
require_once './setaqueryDash.php';
require_once './conecta.php';
$resultado = ibase_query($CONEXAO_TERM, QueryDashDesafios(substr($loja_selecionada, 0,3),$data_dash));//executa query e armazena o resultado em um array
while ($dash1 = ibase_fetch_row($resultado)){
$dataPoints[] = ['y' => $dash1['0'],
'label' => $dash1['1']
];
}
?>
I have tested and the data of this array is correct, it is the data that I really want...
My question is how to make this data be those of the Graph. Follow graph generation code:
<script>
var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var color = Chart.helpers.color;
var horizontalBarChartData = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], //exemplo
// labels: "aqui gostaria dos meus dados"
datasets: [{
label: 'Dataset 1',
backgroundColor: color(window.chartColors.blue).alpha(0.5).rgbString(),
borderColor: window.chartColors.blue,
borderWidth: 1,
// data: "aqui gostaria dos meus dados",
data: [
125000,
125000,
125000,
125000,
125000,
125000,
125000
] // como ta no exemplo
}]
};
In that case I would like to bring the Labels and Data from the array.
Thank you...
I’m actually wondering if I can wear something like that....
– Alexandre Prezzi