Viewing file:      v_grpPercentGrade.php (5.01 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php $categories = ''; //foreach($result->result() as $j){  //$categories .= "'".$j->crsCode."',"; //}
  //print_r($result->result()); $temp = $result->result_array(); $typeGrade = array('A'=>'rdANum','B+'=>'rdBpNum','B'=>'rdBNum','C+'=>'rdCpNum' ,'C'=>'rdCNum','D+'=>'rdDpNum','D'=>'rdDNum','F'=>'rdFNum','W'=>'rdWNum');
  $max = max($temp[0]["numStd0"],$temp[0]["numStd1"],$temp[0]["numStd2"],$temp[0]["numStd3"],$temp[0]["numStd4"]); $min = min($temp[0]["numStd0"],$temp[0]["numStd1"],$temp[0]["numStd2"],$temp[0]["numStd3"],$temp[0]["numStd4"]);
  ?> <script type="text/javascript" src="<?php echo base_url();?>libraries/Highcharts/js/highcharts.js"></script> <script type="text/javascript" src="<?php echo base_url();?>libraries/Highcharts/js/modules/exporting.src.js"></script>             <table border="0" width="740" align="center">     <?php echo form_open($this->config->item("rg_folder").'regist2pieis/grpPercentGrade'); ?>     <tr><th>ปีการศึกษา/ภาคการศึกษา <?php echo form_dropdown('year', $opt_acY,$year); ?>     <?php echo form_dropdown('term', $opt_tm,$term); ?>     ชั้นปี <?php echo form_dropdown('sy', $opt_sy,$sy); ?>     กราฟ <?php echo form_dropdown('type', array("pie" => "Pie" , "column" => "Column"),$type); ?>     <input type="submit" name="search" id="search" value="ค้นหา" style="height:25px; width:35px">     </th></tr>     <tr><td><div id="container2"></div></td></tr>     <tr><td>     <!-- table class="headCol">         <tr>             <th colspan="2" rowspan="2">วิชา</th>             <th colspan="<?php echo count($typeGrade);?>">จำนวนนักศึกษา (คน)</th>         </tr>         <tr> <?php     foreach($typeGrade as $k => $v){                 echo "<th>$k</th>";         }         //echo "<th>รวม</th>"; ?>         </tr>         <?php /*             $i=0;             foreach($result->result() as $v){                 $i++;                 echo "<tr>";                 echo "<td align='center'>$i</td>";                 echo "<td> ".$v->crsCode.' '.$v->crsName."</td>";                 $sum = 0;                 foreach($typeGrade as $type => $field){                                     echo "<td align='center'>".$v->$field."</td>";                     $sum += $v->$field;                 }                 //echo "<td align='center'>".$sum."</td>";                 echo "</tr>";             }*/         ?> </table--></td></tr> <script type="text/javascript">     function test() {             chart = new Highcharts.Chart({         chart: {             renderTo: 'container2',             plotBackgroundColor: null,             plotBorderWidth: null,             plotShadow: false         },         title: {             text: 'รายงานสรุป GPA ของนักศึกษา'         },         xAxis: {             categories: ['0.00-1.99', '2.00-2.49', '2.00-2.49', '3.00-3.49', '3.50-4.00']         },         yAxis: {                     plotLines: [{                                  color: '#FF0000',                 dashStyle: 'ShortDash',                 width: 2,                 value: <?php echo $max;?>,                 zIndex: 0,                 label : {                     text : 'Max <?php echo $max;?> คน'                 }             }, {                 color: '#008000',                 dashStyle: 'ShortDash',                 width: 2,                 value: <?php echo $min;?>,                 zIndex: 0,                 label : {                     text : 'Min <?php echo $min;?> คน'                 }             }]                      },         plotOptions: {             pie: {                 allowPointSelect: true,                 cursor: 'pointer',                 dataLabels: {                     enabled: true,                     color: '#000000',                     connectorColor: '#000000',                     formatter: function() {                             return '<b>'+ this.point.name +'</b>: '+ this.percentage.toFixed(2) +' %';                         },                     tooltip: {                         pointFormat: '{series.name}: <b>{point.percentage}%</b>',                         percentageDecimals: 2                     },                     percentageDecimals: 2                                          }             },                     column: {                 pointPadding: 0.2,                                 borderWidth: 0,                 dataLabels: {                                     color: '#000000',                                     connectorColor: '#000000',                                     formatter: function() {                                             return '<b>'+ this.point.name +'</b>: '+ this.percentage.toFixed(2) +' %';                                         },                                     tooltip: {                                         pointFormat: '{series.name}: <b>{point.percentage}%</b>',                                         percentageDecimals: 2                                     }                                                                          }                                             }         },         series: [{             type: '<?php echo $type; ?>',             name: 'จำนวนคน',             data: [                 ['0.00-1.99 จำนวน <?php echo $temp[0]["numStd0"];?> คน',   <?php echo $temp[0]["numStd0"]; ?> ],                 ['2.00-2.49 จำนวน <?php echo $temp[0]["numStd1"];?> คน',    <?php echo $temp[0]["numStd1"]; ?>],                 ['2.00-2.49 จำนวน <?php echo $temp[0]["numStd2"];?> คน',    <?php echo $temp[0]["numStd2"]; ?>],                 ['3.00-3.49 จำนวน <?php echo $temp[0]["numStd3"];?> คน',    <?php echo $temp[0]["numStd3"]; ?>],                 ['3.50-4.00 จำนวน <?php echo $temp[0]["numStd4"];?> คน',     <?php echo $temp[0]["numStd4"]; ?>]             ]         }]         });     }     
  </script>                          <script type="text/javascript"> $(function () {     var chart;       test();       //columnDrilldown(); // ฟังชันผมสร้างไว้ใน js ใน myCreate ค๊าบบบบ });         </script> 
  |