Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'config/konek.php';
- $query = "select * from report";
- $hasil = mysql_query($query);
- $bulan='';$keberhasilan='';$kegagalan='';
- while ($row = mysql_fetch_object($hasil)) {
- $bulan.=($bulan!=''?',':'')."'".$row->bulan."'";
- $berhasil=$row->berhasil;
- $gagal=$row->gagal;
- $total = $berhasil+ $gagal;
- $keberhasilan.=($keberhasilan!=''?",'":"'").($total == 0?0:$berhasil/$total * 100)."'";
- $kegagalan.=($kegagalan!=''?",'":"'").($total == 0?0:$gagal/$total * 100)."'";
- }
- ?>
- <html>
- <head>
- <script type="text/javascript" src="js/jquery.min.js"></script>
- <script src="js/highcharts.js"></script>
- <script src="js/modules/exporting.js"></script>
- <script type="text/javascript">
- var chart;
- $(document).ready(function() {
- chart = new Highcharts.Chart({
- chart: {
- renderTo: 'container',
- zoomType: 'xy'
- },
- title: {
- text: 'Laporan Grafik pelatihan'
- },
- subtitle: {
- text: 'LMC'
- },
- xAxis: [{
- categories: [<?php echo $bulan;?>]
- }],
- yAxis: [{
- labels: {
- formatter: function() {
- return this.value +'';
- },
- style: {
- color: '#6cb3ea'
- }
- },
- title: {
- text: 'Persentase training(%)',
- style: {
- color: '#6cb3ea'
- }
- }
- }],
- tooltip: {
- formatter: function() {
- return ''+
- this.x +': '+ this.y +
- (this.series.name == 'Presentase' ? '' : '%');
- }
- },
- legend: {
- layout: 'vertical',
- align: 'left',
- x: 100,
- verticalAlign: 'top',
- y: 100,
- floating: true,
- backgroundColor: '#FFFFFF'
- },
- series: [{
- name: 'Berhasil Dilaksanakan',
- color: '#4572A7',
- type: 'column',
- data: [<?php echo $keberhasilan;?>]
- }, {
- name: 'Gagal Dilaksanakan',
- color: '#eaff00',
- type: 'column',
- data: [<?php echo $kegagalan;?>]
- }]
- });
- });
- </script>
- </head>
- <body>
- <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement