Mencari Nilai Minimum 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>";
$strData1 = "<dataset seriesName='Minimum'>";
$strCategories .= "<category name='Negeri ".$desc_state['desc_state']."' />";
//Starting to generate minimum of value
$count1 = $this->petunjuk_model->count2_state($year, '1', $cdstate);
if($min != 0){
$bilresponden1 = number_format($count1['Minimum'],2);
}else{
$bilresponden1 = "0.00";
}
$strCategories .= "</categories>";
$strData1 .= "</dataset>";
$strXML .= $strCategories . $strData1 ."</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 1:
$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.Minimum', "asc");
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 minimum iaitu nilai yang dijana daripada
Daerah Hulu Langat
Posted by : epulhasan
Date : 8/11/2016
Reference : Sistem QAP
0 comments:
Post a Comment