Jump to content
Fórum Script Brasil
  • 0

Grafico com Flot + PHP + MySQL


Question

boa tarde,

estou tentando passar valores de uma consulta para um grafico mas não consigo apontar a variavel no script, manualmente da certo, mas dinamicamente não aparece o grafico, esta assim:

 

<?php
    
    $result = mysqli_query($con,"select sum(quantidade) as qtd, obra_cliente from dosagem_usina where operacao ='saida' group by obra_cliente order by qtd desc");        

    while($row = mysqli_fetch_assoc($result))
    {
        $obra = $row['obra_cliente'];
        $qtd_cbuq = $row['qtd'];


    }
/*
     * BAR CHART
     * ---------
     */

    var bar_data = {
      data : [[50,180],[10,20]], <----- aqui manualmente vai, mas não consigo passar o array das variaveis
      bars: { show: true }
    }
    $.plot('#bar-chart', [bar_data], {
      grid  : {
        borderWidth: 1,
        borderColor: '#f3f3f3',
        tickColor  : '#f3f3f3'
      },
      series: {
         bars: {
          show: true, barWidth: 0.5, align: 'center',
        },
      },
      colors: ['#3c8dbc'],
      xaxis : {
        ticks: [[1,'Janeiro'], [2,'February'], [3,'March'], [4,'April'], [5,'May'], [6,'June']]
      }
    })
    /* END BAR CHART */

 

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      148690
    • Total Posts
      644529
×
×
  • Create New...