

function ciy_chart_bank1_l3(opdata) {
    this.func = ['bank_l3'];
    this.lastdata = {};
    this.resize = function () {
        chart1.resize();
    }
    this.setdata = function (funame, data) {
        if (!data)
            return;
        this.lastdata[funame] = data;

        var pdatas = [];
        var pmonths = [];
        var pdata = {
            type: 'bar',
            barWidth: 25 * Glob.bet,
            stack: 'total',
            itemStyle: {
                borderRadius: [5, 5, 0, 0],
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: '#0cbb00' },
                { offset: 1, color: '#033400' }])
            },
            label: {
                show: true,
                fontFamily: 'eng01',
                formatter: function (a) {
                    if (a.value > minbar)
                        return a.value;
                    else
                        return '';
                }
            },
            data: []
        };
        pdatas.push(pdata);

        var now = new Date();
        var sdate = new Date();
        sdate.setMonth(sdate.getMonth() - 11);
        sdate.setDate(1);
        sdate.setHours(0);
        sdate.setMinutes(0);
        sdate.setSeconds(0);
        var barmax = 0;
        while (true) {
            var edate = new Date(sdate.getFullYear(), sdate.getMonth(), sdate.getDate());
            edate.setMonth(edate.getMonth() + 1);
            pmonths.push((sdate.getMonth() + 1) + '月');
            var stime = +sdate / 1000;
            var etime = +edate / 1000;
            var typecnt = 0;
            var cnt = 0;
            for (var ibp in data.patrols) {
                var val = parseInt(data.patrols[ibp].addtimes);
                if (val < stime || val > etime)
                    continue;
                cnt++;
            }
            typecnt += cnt;
            pdatas[0].data.push(cnt);
            if (barmax < typecnt)
                barmax = typecnt;
            sdate = edate;
            if (sdate > now)
                break;
        }
        minbar = barmax * 16 / 300;

        var option = {
            backgroundColor: '',
            textStyle: {
                fontSize: Glob.fontsize
            },
            color: ['#ffd42d', '#4992ff', '#c1c1c1'],
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                top: 0,
                right: 20 * Glob.bet
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            yAxis: {
                type: 'value',
                axisLabel: {
                    formatter: '{value}'
                },
                splitLine: {
                    lineStyle: {
                        color: 'rgba(255,255,255,0.2)'
                    }
                }
            },

            xAxis: {
                type: 'category',
                data: pmonths
            },
            series: pdatas
        };
        chart1.setOption(option);
    }
    this.distory = function () {
        echarts.dispose($5('#chart1', opdata.container)[0]);
        chart1.dispose();
        chart1 = null;
    }

    var chart1 = null;
    opdata.container.append(`<div class="brimg " style="background: #00000011;">
        <div style="pointer-events: none;min-width:180px;padding-left: 1.5em;">
            <span style="color:#fffffd;font-weight: bolder;letter-spacing: 2px;">近一年监管趋势图</span>
            <div style="position: relative;margin-top: 0.6em;">
            <img src="/ud/bigscreen/tit/06.png" style="height:0.3em;display: block;">
            <div style="position: absolute;left: 12em;right: 1.5em;border-bottom:0.05em solid #64ecf7;"></div>
            </div>
        </div>
        <div id="chart1" style="position: absolute;top: 0;bottom: 0;left:0;right:0;"></div>
    </div>`);

    chart1 = echarts.init($5('#chart1', opdata.container)[0], 'dark');
    var minbar = 100;
    this.resize();

    // var style = document.createElement("style");
    // style.innerHTML = `
    // `;
    // window.document.head.appendChild(style);

}