Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

122
Visualizações
Pls Help me Draw Google Chart Codeigniter

I have a one question. google chart not draw. I checked the php code and the script without the php code , it's ok. But when I put them together, google chart not draw. My English not good. Sorry. php code result

[script result

<script type="text/javascript">
      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawChart);

      function drawChart() {
        var data = google.visualization.arrayToDataTable([
            ['Month', 'Bán ra', 'Đơn hàng'],
            <?php 
            $d=getdate();
            $year=$d['year'];
            for ($i=1; $i <= 12 ; $i++) 
            {   
                $list_orrders = $this->transaction_model->order_follow_month($year, $i);
                $sum = 0;
                foreach ($list_orrders as $row_orrder) 
                {
                    $sum = $this->order_model->get_sum('qty',array('cart_id'=>$row_orrder->id));

                }
                if($i >= 1 && $i <=9)
                {
                    echo "['0".$i.'/'.$year."',".$sum.",".count($list_orrders)."],";
                }
                else
                {
                    echo "['".$i.'/'.$year."',".$sum.",".count($list_orrders)."],";
                }
            }
             ?>
            ]);

        var options = {
          chart: {
            title: 'Company Performance',
            subtitle: 'Sales, Expenses',
          }
        };

        var chart = new google.charts.Bar(document.getElementById('columnchart_material'));

        chart.draw(data, google.charts.Bar.convertOptions(options));
      }
    </script>

]2

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It looks like your <?php is not interpreted and your $this->transaction_model->order_follow_month($year, $i); and $this->order_model->get_sum('qty',array('cart_id'=>$row_orrder->id)); comes from nowhere here.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda