<?php 
    function isnull($txt){
        if($txt==''||$txt=='0'){
            $ret='0';
        }else{
            $ret=$txt;
        }
        return $ret;
    }
?>
<script src="<?php echo base_url();?>resources/js/hichart/highcharts.js"></script>
<script src="<?php echo base_url();?>resources/js/hichart/modules/data.js"></script>
<script src="<?php echo base_url();?>resources/js/hichart/modules/exporting.js"></script>
<script src="<?php echo base_url();?>resources/js/hichart/themes/sand-signika.js"></script>

<div align="left" style="height:100%; width: 100%">
    <div id="grafik_mediasi" style="width:95%;min-width: 310px; height: 80%; margin: 5% auto"></div>
</div>

<br/>
<div class="cssTable">
        <table id="statistik_mediasi">
                <col  width="40%" />
                <col  width="15%" />
                <col  width="15%" />
                <col  width="15%" />
                <col  width="15%" />
                <tbody>
                        <tr>
                                <td>Klasifikasi Perkara</td>
                                <td>Akta Perdamaian/Putusan</td>                                
                                <td>Berhasil Sebagian</td>                                
                                <td>Pencabutan</td>                                
                                <td>Tidak Berhasil</td>                                
                                <td>Tidak dapat dilaksanakan</td>                                

                        </tr>
                        <?php
                        if($rekap->num_rows>0){
                                foreach ($rekap->result() as $row) {
                                        echo "<tr>";
												echo "<td style ='text-align:center'>".$row->nama."</td>";
												echo "<td style ='text-align:center'>".isnull($row->berhasil_akta)."</td>";
												echo "<td style ='text-align:center'>".isnull($row->berhasil_sebagian)."</td>";
                                                echo "<td style ='text-align:center'>".isnull($row->berhasil_cabut)."</td>";
                                                echo "<td style ='text-align:center'>".isnull($row->tidak_berhasil)."</td>";
                                                echo "<td style ='text-align:center'>".isnull($row->tidak_dpt_dilaksanakan)."</td>";
                                        echo "</tr>";
                                }
                        }
                        ?>
                </tbody>
        </table>
      
</div>
<script>
$('#statistik_mediasi').hide();

    $('#grafik_mediasi').highcharts({
        data: {
            table: document.getElementById('statistik_mediasi'),
            // switchRowsAndColumns: true
        },
        chart: {
            type: 'bar',

        },
        plotOptions: {
        column: {
        dataLabels: {
            enabled: true,
            }
            }
        },
        title: {
            text: 'Grafik Jumlah Hasil Mediasi Berdasarkan Klasifikasi'
        },
        yAxis: {
            allowDecimals: false,
            title: {
                text: 'Jumlah'
            }
        },
        tooltip: {
            formatter: function() {
                return '<b>'+ this.point.name +'</b><br/>'+
                    this.series.name +' '+ this.point.y;
            }
        }
    });

</script>

