//心电图的历史数据
var hisArray = [];
var hisFlag = false;
layui.use(['layer', 'form', 'laydate', 'admin', 'ax'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var laydate = layui.laydate;
    var admin = layui.admin;
    var layer = layui.layer;

    var ajaxIndex = new $ax(Feng.ctxPath + "/grade/getRatio/?id=" + Feng.getUrlParam("id"));
    var resultIndex = ajaxIndex.start();
    //form.val('indexForm', resultIndex.data);
    var dates = resultIndex.data;
    form.render();

    var arrayX = [];
    var arrayY = [];
    for (var i=0; i<6; i++){
        var a = dates[i];
        for (var key in a){
            arrayX[i] = a[key];
            arrayY[i] = key;
        }
    }

    var myChart = echarts.init(document.getElementById('container'));

    // 指定图表的配置项和数据
    var option = {
        color: ['#3398DB'],
        tooltip: {
            trigger: 'axis',
            axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                data: arrayY,
                axisTick: {
                    alignWithLabel: true
                }
            }
        ],
        yAxis: [
            {
                type: 'value'
            }
        ],
        series: [
            {
                name: '直接访问',
                type: 'bar',
                barWidth: '60%',
                data: arrayX
            }
        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);



});

