简体   繁体   English

请帮我绘制谷歌图表 Codeigniter

[英]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.我检查了php代码和没有php代码的脚本,没关系。 But when I put them together, google chart not draw.但是当我把它们放在一起时,谷歌图表没有绘制。 My English not good.我的英语不好。 Sorry.对不起。 php code result php代码结果

[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 ] 2

It looks like your <?php is not interpreted and your $this->transaction_model->order_follow_month($year, $i);看起来你的<?php没有被解释,你的$this->transaction_model->order_follow_month($year, $i); and $this->order_model->get_sum('qty',array('cart_id'=>$row_orrder->id));$this->order_model->get_sum('qty',array('cart_id'=>$row_orrder->id)); comes from nowhere here.不知从何而来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM