<?php 
   $qp="SELECT * FROM sv_master_produk";
   if(!empty($this->input->post('b'))){
       $qp.=" WHERE brand='".$this->input->post('b')."'";
   }
   if(!empty($this->input->post('j'))){
       $qp.=" AND jenis_produk='".$this->input->post('j')."'";
   }
   $produk=$this->db->query($qp)->result_array();
   $gdg=($this->input->post('g')?$this->input->post('g'):'');
   $tlgdg=($this->input->post('g')!=null?GetValue('title','master_gudang',array('id'=>'where/'.$this->input->post('g'))):'Semua Gudang');
?>

<script>
    
$(function () {
 

            // Create the chart
            $('#chart_total_stok').highcharts({
    chart: {
        type: 'column'
    },
    title: {
        text: 'Total Stok <?php echo $tlgdg ?>'
    },
    xAxis: {
        categories: [
            <?php foreach($produk as $pr){ ?>
                    '<?php echo $pr['title'] ?>',
            <?php }?>
                ]
    },
    credits: {
        enabled: false
    },
    series: [{
        name: 'Total Stok',
        data: [<?php foreach($produk as $pr){ ?>
                    <?php echo GetSumStok($pr['id'],$gdg);
                            
                            //lastq()?>,
            <?php }?>]
    }   ]
});
});
</script>
<div class="col-md-12">
<div id="chart_total_stok" style="min-width: 1000px; max-width: 100%; height: 400px; margin: 0 auto"></div>
</div>