<?php function buatrp($angka) { $jadi = "" . number_format($angka,0,',','.'); return $jadi; } ?>

<div class="row">
    <a name="10diagnosarajal"></a>
    <div class="col-md-12">
        <div class="box">
            <div class="box-header with-border">
                <h3 class="box-title">10 Besar Diagnosa Penyakit Rawat Jalan</h3>
                <div class="box-tools pull-right">
                    <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                    <a href="<?php echo base_url('admin/home'); ?>" class="btn btn-box-tool"><i class="fa fa-times"></i></a>
                </div>
            </div>
            <div class="box-body">
                <div id="jalan" class="chart"></div>
                        <table class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th>Kode</th>
                                    <th>Keterangan</th>
                                </tr>
                            </thead>
                            </tbody>
                                <?php foreach ($chart_besar_irja as $row) { ?>
                                    <tr>
                                        <td><b><?php echo $row->id_diag; ?></b></td>
                                        <td><?php echo $row->desc_diag; ?></td>
                                    </tr>
                                    <?php } ; ?>
                            </tbody>
                        </table>
            </div>
            <div class="box-footer">
                <i class="fa fa-clock-o"></i> Data realtime
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
// ===== 10 BESAR RAWAT JALAN =====
var jalan = AmCharts.makeChart("jalan", {
    "theme": "light",
    "type": "serial",
    "startDuration": 2,
    "dataProvider": [
        <?php foreach ($chart_besar_irja as $content): ?>
        {
            "diagnosa" : "<?php echo $content->id_diag; ?>",
            "jumlah" : <?php echo $content->jumlah_kasus; ?>,
            "color": "<?php printf( "#%06X", mt_rand( 0, 0xFFFFFF )); ?>"
        },
        <?php endforeach; ?>
    ],
    "valueAxes": [{
        "position": "left",
        "title": "Jumlah"
    }],
    "graphs": [{
        "balloonText": "[[category]]: <b>[[value]]</b>",
        "fillColorsField": "color",
        "fillAlphas": 1,
        "lineAlpha": 0.1,
        "type": "column",
        "valueField": "jumlah"
    }],
    "depth3D": 20,
    "angle": 30,
    "chartCursor": {
        "categoryBalloonEnabled": false,
        "cursorAlpha": 0,
        "zoomable": false
    },    
    "categoryField": "diagnosa",
    "categoryAxis": {
        "gridPosition": "start"
    },
    "export": {
        "enabled": true
     },

});
</script>