aries_

Grafik_1

Jun 26th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.55 KB | None | 0 0
  1. <?php
  2. include 'config/konek.php';
  3. echo " <font color=#000>
  4.    <b>Filter Tanggal Berdasarkan ";
  5. echo "<form method=POST action=?module=graph>
  6.    Tanggal Mulai : <input type='text' name='tanggal' size='10'>
  7.    Tanggal Akhir : </b><input type='text' name='tanggal_2' size='10'>
  8.     <input type='submit' name='cari' value='Cari'>
  9.     </form><br>";
  10.      
  11. $query = "select count(*) as Berhasil from plan where Terlaksana = 'Berhasil'";
  12. $hasil = mysql_query($query);
  13. $data  = mysql_fetch_array($hasil);
  14. $Berhasil= $data['Berhasil'];
  15.  
  16. // mencari jumlah kegagalan dari database
  17. $query = "select count(*) as Gagal from plan where Terlaksana != 'Berhasil'";
  18. $hasil = mysql_query($query);
  19. $data  = mysql_fetch_array($hasil);
  20. $Gagal = $data['Gagal'];
  21.  
  22. // menghitung total training
  23. $total = $Berhasil+ $Gagal;
  24.  
  25. // menghitung presentase berhasil dan gagal
  26. if ($total == 0) {
  27.     echo "Tidak ada Pelatihan yang terjadi";
  28. }else {
  29. $keberhasilan = $Berhasil/$total * 100;
  30. $kegagalan = $Gagal/$total * 100;
  31. }
  32.  
  33. ?>
  34. <html>
  35.         <head>
  36.                 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  37.                 <title>TCH Drop Rate vs TCH Traffic</title>
  38.                
  39.                 <!-- 1. Add these JavaScript inclusions in the head of your page -->
  40.                 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
  41.                 <script type="text/javascript" src="js/highcharts.js"></script>
  42.                
  43.                 <!-- 1a) Optional: add a theme file -->
  44.                 <!--
  45.                         <script type="text/javascript" src="../js/themes/gray.js"></script>
  46.                 -->
  47.                
  48.                 <!-- 1b) Optional: the exporting module -->
  49.                 <script type="text/javascript" src="js/modules/exporting.js"></script>
  50.                
  51.                
  52.                 <!-- 2. Add the JavaScript to initialize the chart on document ready -->
  53.                 <script type="text/javascript">
  54.                
  55.                       var chart;
  56. $(document).ready(function() {
  57.     chart = new Highcharts.Chart({
  58.         chart: {
  59.             renderTo: 'container',
  60.             type: 'column'
  61.         },
  62.         title: {
  63.             text: 'Monthly Average Rainfall'
  64.         },
  65.         subtitle: {
  66.             text: 'Source: WorldClimate.com'
  67.         },
  68.         xAxis: {
  69.             categories: [
  70.                 'Jan',
  71.                 'Feb',
  72.                 'Mar',
  73.                 'Apr',
  74.                 'May',
  75.                 'Jun',
  76.                 'Jul',
  77.                 'Aug',
  78.                 'Sep',
  79.                 'Oct',
  80.                 'Nov',
  81.                 'Dec'
  82.             ]
  83.         },
  84.         yAxis: {
  85.             min: 0,
  86.             title: {
  87.                 text: 'Rainfall (mm)'
  88.             }
  89.         },
  90.         legend: {
  91.             layout: 'vertical',
  92.             backgroundColor: '#FFFFFF',
  93.             align: 'left',
  94.             verticalAlign: 'top',
  95.             x: 100,
  96.             y: 70,
  97.             floating: true,
  98.             shadow: true
  99.         },
  100.         tooltip: {
  101.             formatter: function() {
  102.                 return ''+
  103.                     this.x +': '+ this.y +' mm';
  104.             }
  105.         },
  106.         plotOptions: {
  107.             column: {
  108.                 pointPadding: 0.2,
  109.                 borderWidth: 0
  110.             }
  111.         },
  112.             series: [{
  113.             name: 'Berhasil',
  114.             data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
  115.  
  116.         }, {
  117.             name: 'Gagal',
  118.             data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1]
  119.  
  120.         }]
  121.     });
  122. });
  123.                 </script>
  124.                
  125.         </head>
  126.         <body>
  127.        
  128.                 <!-- 3. Add the container -->
  129.                 <div id="container" style="width: 800px; height: 400px; margin: 0 auto"></div>
  130.                
  131.                                
  132.         </body>
  133. </html><?php
  134.  
  135. echo "<b> <h3> Jumlah Pelatihan saat ini : $total pelatihan</h3></b>";
  136. ?>
Advertisement
Add Comment
Please, Sign In to add comment