<div class="row">
    <div class="col-md-10">
        <a name="bulan"></a>
        <div class="box">
            <div class="box-header with-border">
                <h3 class="box-title"><?php if($title == 'Indikator RS' ) { echo urldecode($this->uri->segment('3')); } else { echo $title; } ?>
                </h3>
            </div>
            <div class="box-body"> 
                <form action="<?php echo site_url('home/'.$uri); ?>" method="POST">
                    <div class="col-md-4 col-md-offset-4">
                        <label>Tahun ( Periode Tahun ) :</label>
                        <div class="input-group">
                                <select name="tahun" class="form-control">
                                    <option>[Pilih]</option>
                                    <?php for ($i = date('Y'); $i >= (date('Y') - 5 ); $i--): ?>
                                        <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
                                    <?php endfor; ?>
                                </select>
                            <div class="input-group-btn">
                                <button type="submit" class="btn btn-primary" name="filter"><i class="fa fa-filter"></i> Pilih</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>           
            
            <div class="box-body">
                  <div id="chart" class="chart"></div>
            </div>
           
        </div>
    </div>
</div>
<?php //echo print_r($data);?>

<script type="text/javascript">

// ===== KUNJUNGAN IRJA HARI INI =====
var chart = AmCharts.makeChart( "chart", {
    "theme": "light",
    "type": "serial",
    "startDuration": 2,
    "dataProvider": [
      <?php foreach ($data as $content){ ?>
        {
            "country": "<?php echo ConvertBulan($content->Bulan)." ".$content->Tahun; ?>",
            "visits": <?php echo $content->Jumlah; ?>,
            "color": "<?php printf( "#%06X", mt_rand( 0, 0xFFFFFF )); ?>"
        },
        <?php } ?>
        ],
    "valueAxes": [{
        "position": "left",
        "axisAlpha":0,
        "gridAlpha":0
    }],
    "graphs": [{
        "balloonText": "[[category]]: <b>[[value]]</b>",
        "colorField": "color",
        "labelText": "[[value]]",
        "fillAlphas": 0.85,
        "lineAlpha": 0.1,
        "type": "column",
        "topRadius":1,
        "valueField": "visits"
    }],
    "depth3D": 40,
  "angle": 30,
    "chartCursor": {
        "categoryBalloonEnabled": false,
        "cursorAlpha": 0,
        "zoomable": false
    },
    "categoryField": "country",
    "categoryAxis": {
        "gridPosition": "start",
        "axisAlpha":0,
        "gridAlpha":0

    },
    "export": {
      "enabled": true
     }

}, 0);
</script>