<?php 
   $qp="select count(sv_stok_in.id) as fast, produk,sv_master_produk.title title from sv_master_produk left join sv_stok_in on sv_stok_in.produk=sv_master_produk.id  where (param='in' or param='out') ";
   if(!empty($this->input->post('b'))){
       $qp.=" AND sv_master_produk.brand='".$this->input->post('b')."'";
   }
   if(!empty($this->input->post('j'))){
       $qp.=" AND sv_master_produk.jenis_produk='".$this->input->post('j')."'";
   }
   if(!empty($this->input->post('g'))){
       $qp.=" AND sv_stok_in.gudang='".$this->input->post('g')."'";
   }
   $qp.=" group by produk order by fast asc";
   $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_fast_stok').highcharts({
    chart: {
        type: 'column'
    },
    title: {
        text: 'Fast Moving Stok Stok <?php echo $tlgdg ?>'
    },
    xAxis: {
        categories: [
            <?php foreach($produk as $pr){ ?>
                    '<?php echo $pr['title'] ?>',
            <?php }?>
                ]
    },
    credits: {
        enabled: false
    },
    series: [{
        name: 'Fast Moving Stok',
        data: [<?php foreach($produk as $pr){ ?>
                    <?php echo $pr['fast'];
                            
                            //lastq()?>,
            <?php }?>]
    }   ]
});
});
</script>
<div class="col-md-12">
<div id="chart_fast_stok" style="min-width: 1000px; max-width: 100%; height: 400px; margin: 0 auto"></div>
</div>