Tuesday, 8 November 2016


  Mencari Nilai Maksimum Untuk Penghasilan Graf

        Controller

        class Petunjuk extends MY_Controller {

        function __construct() {
        parent::__construct();
      
        $this->load->helper("fusioncharts_helper"); //coding untuk fusion chart


        }
     

          $graph_swfFile      = base_url().'assets/fscharts/StackedColumn3D.swf';
         $graph_width        = 850 ;
         $graph_height       = 450 ;
           
        $strXML = "<chart caption='QAP PENJAGAAN KESIHATAN PRIMER - Taburan Markah Mengikut Daerah' xAxisName='Julat Markah' yAxisName='Peratus Responden' formatNumberScale='1' rotateValues='1' placeValuesInside='1' numbersuffix='%' decimals='2'>";

        $strCategories = "<categories>";

        $strData3 = "<dataset seriesName='Minimum'>";

         $strCategories .= "<category name='Negeri ".$desc_state['desc_state']."' />";
        //Starting to generate maksimum of value
        $count1 = $this->petunjuk_model->count2_state($year, '1', $cdstate);

                  $count3 = $this->petunjuk_model->count2_state($year,  '3', $cdstate);

                     if($mak != 0){
                            $bilresponden3 = number_format($count3['Maksimum'],2); 
                    }else{
                            $bilresponden3 =  "0.00";
                    }
      
        $strData3 .= "<set value='" . $bilresponden3. "' />";
       

       
        $strCategories .= "</categories>";
        $strData3 .= "</dataset>";
              
         $strXML .= $strCategories . $strData3 ."</chart>";
         echo '<div class="text-center">';   
         echo renderChart($graph_swfFile, '', $strXML, 'div5' , $graph_width, $graph_height, false, false);
         echo '</div>';

         }



      Model

     class Petunjuk_model extends CI_Model  {  
 
        function __construct() {
        parent::__construct();
       
        $this->load->model("report_model");
     
      }


 
       function count2_state($year, $cdscore, $cdstate) {
                     
    switch ($cdscore) {
       
                   case 3:    
                        $this->db->from('tr_median');      
                        $this->db->where('SUBSTRING(cd_district,1,2)  = "'.$cdstate.'"'); 
                        $this->db->where('tr_median.year = "'.$year.'"');
                        $this->db->where('tr_median.cd_klinikProgram = "1"');
                        $this->db->order_by('tr_median.Maksimum', "desc");

                        break;
                            
                        default:
                        exit;
                        break;
                                                
    }


    return $query  = $this->db->get()->row_array();
      
    }



    OUPUT
   

    Contoh input di mana akan membandingkan dua daerah iaitu Gombak dan Hulu Langat.  
    Negeri Selangor akan memaparkan nilai maksimum iaitu nilai yang dijana daripada    
    Daerah Hulu Langat



   Posted by : epulhasan
   Date : 8/11/2016 
   Reference :  Sistem QAP















0 comments:

Post a Comment