/**
 * @fileoverview added by tsickle
 * Generated from: business-component/chart/pie/ring-pie/ring-pie.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { debounceTime } from 'rxjs/operators';
import { fromEvent } from 'rxjs';
import { ChartResizeService } from '../../service/chart-resize.service';
import { RingPieService } from './service/ring-pie.service';
var RingPieComponent = /** @class */ (function () {
    function RingPieComponent(chartResizeService, //自适应大小
    ringPieService //自适应大小
    ) {
        this.chartResizeService = chartResizeService;
        this.ringPieService = ringPieService;
        this.chartTitleColor = '';
        this.chartTitle = {
            show: true,
            label: "图表标题"
        };
        this.customToolBox = {
            show: true,
        };
        //接口区
        this.cardBgColor = "#fff";
        this.fontColor = "#000";
        this.cardPadding = "1rem";
        this.bcacChart = {
            data: 0,
            total: 100,
            name: '在线',
            color: ['#57ff6f', '#d1ffcc']
        };
        // 加载等待
        this._bcacChartLoading = false;
        // 下拉框数据
        this.dataSourceSelectData = [];
        this.bcacDataSourceSelectEmit = new EventEmitter();
        this.chartOption = {
            title: this.ringPieService.getChartTitle(this.bcacChart),
            series: this.ringPieService.getChartSeries(this.bcacChart)
        };
    }
    /**
     * @param {?} ec
     * @return {?}
     */
    RingPieComponent.prototype.onOptionInit = /**
     * @param {?} ec
     * @return {?}
     */
    function (ec) {
        this.optionInit = ec;
    };
    // echart配置项
    // echart配置项
    /**
     * @return {?}
     */
    RingPieComponent.prototype.initEchart = 
    // echart配置项
    /**
     * @return {?}
     */
    function () {
        this.options = this.chartOption;
    };
    Object.defineProperty(RingPieComponent.prototype, "bcacDarkMode", {
        set: /**
         * @param {?} darkMode
         * @return {?}
         */
        function (darkMode) {
            this.cardBgColor = this.ringPieService.getBgColor(darkMode).bgColor;
            this.fontColor = this.ringPieService.getBgColor(darkMode).fontColor;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingPieComponent.prototype, "bcacSmallMode", {
        set: /**
         * @param {?} smallMode
         * @return {?}
         */
        function (smallMode) {
            if (smallMode) {
                this.cardPadding = "0rem";
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingPieComponent.prototype, "bcacTitleSwitch", {
        set: /**
         * @param {?} titleSwitch
         * @return {?}
         */
        function (titleSwitch) {
            this.chartTitle.show = titleSwitch;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingPieComponent.prototype, "bcacTitle", {
        set: /**
         * @param {?} title
         * @return {?}
         */
        function (title) {
            this.chartTitle.label = title;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingPieComponent.prototype, "bcacChartShowToolbox", {
        set: /**
         * @param {?} toolboSwitch
         * @return {?}
         */
        function (toolboSwitch) {
            this.customToolBox.show = toolboSwitch;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingPieComponent.prototype, "bcacChartData", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.bcacChart.data = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingPieComponent.prototype, "bcacChartDataTotal", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.bcacChart.total = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingPieComponent.prototype, "bcacChartName", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.bcacChart.name = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingPieComponent.prototype, "bcacChartColor", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.bcacChart.color = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingPieComponent.prototype, "bcacChartLoading", {
        set: /**
         * @param {?} loading
         * @return {?}
         */
        function (loading) {
            this._bcacChartLoading = loading;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingPieComponent.prototype, "bcacDataSourceList", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.dataSourceSelectData = value;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @param {?} e
     * @return {?}
     */
    RingPieComponent.prototype.dataSourceChange = /**
     * @param {?} e
     * @return {?}
     */
    function (e) {
        this.bcacDataSourceSelectEmit.emit(e);
    };
    /**
     * @return {?}
     */
    RingPieComponent.prototype.updateOption = /**
     * @return {?}
     */
    function () {
        if (this.optionInit) {
            this.optionInit.setOption(this.options, true);
        }
    };
    /**
     * @return {?}
     */
    RingPieComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
    };
    /**
     * @return {?}
     */
    RingPieComponent.prototype.ngOnChanges = /**
     * @return {?}
     */
    function () {
        var _this = this;
        // console.log("改变啦",this.bcacChart);
        this.chartOption = {
            title: this.ringPieService.getChartTitle(this.bcacChart),
            series: this.ringPieService.getChartSeries(this.bcacChart)
        };
        this.initEchart();
        this.updateOption();
        fromEvent(window, 'resize').pipe(debounceTime(200)).subscribe((/**
         * @return {?}
         */
        function () {
            _this.chartResizeService.autoResizeAdapt(_this.optionInit, _this.options);
        }));
    };
    RingPieComponent.decorators = [
        { type: Component, args: [{
                    selector: 'bcac-ring-pie',
                    template: "<div class=\"chart-card\" [ngStyle]=\"{ 'background-color': cardBgColor, padding: cardPadding }\">\r\n    <div nz-row class=\"chart-header\" [ngStyle]=\"{color:fontColor}\">\r\n        <div nz-col nzSpan=\"12\" class=\"chart-title-label\">\r\n            <span *ngIf=\"chartTitle.show\" [nzTooltipTitle]=\"chartTitle.label\" nz-tooltip [ngStyle]=\"{ color: chartTitleColor ? chartTitleColor : 'unset' }\">\r\n                {{ chartTitle.label }}\r\n            </span>\r\n        </div>\r\n        <div *ngIf=\"customToolBox.show\" nz-col nzSpan=\"12\" class=\"custom-tool-box\">\r\n            <!-- \u6570\u636E\u6E90\u5207\u6362 -->\r\n            <bcac-select-group *ngIf=\"dataSourceSelectData.length>0\" [bcacSelectList]=\"dataSourceSelectData\" (bcacSelectedChange)=\"dataSourceChange($event)\">\r\n            </bcac-select-group>\r\n            <!-- \u7C7B\u76EE\u8F74\u95F4\u9694 -->\r\n            <!-- <bcac-single-select-icon *ngIf=\"intervalDatas.length>0\" [bcacSelectData]=\"intervalDatas\" (bcacSelectedEmit)=\"axisScaleChange($event)\">\r\n            </bcac-single-select-icon>\r\n            <bcac-legend-toolbox *ngIf=\"legendPosition==='top'\" [bcacSelectValue]=\"legendDataList\" (bcacSelectValueEmit)=\"legendChange($event)\">\r\n            </bcac-legend-toolbox> -->\r\n            <bcac-chart-menu [fileName]=\"chartTitle.label\" \u00A0[chartInstance]=\"optionInit\"></bcac-chart-menu>\r\n        </div>\r\n\r\n    </div>\r\n    <div\u00A0class=\"chart-body\" [ngClass]=\"{'chart-body-full': !chartTitle.show}\">\r\n        <div echarts [options]=\"chartOption\" class=\"echarts echartfontsize\"\r\n        [loading]=\"_bcacChartLoading\"\r\n        [autoResize]=\"true\"\r\n        [initOpts]=\"{ renderer: 'canvas', devicePixelRatio: 2 }\"\r\n        (chartInit)=\"onOptionInit($event)\"></div>\r\n    </div>\r\n</div>",
                    styles: ["@font-face{font-family:notoSans;src:url(/assets/font/SourceHanSansCN-Regular.ttf) format(\"opentype\")}@font-face{font-family:roboto;src:url(/assets/font/Roboto-Regular.ttf) format(\"opentype\")}body,html{font-family:roboto,notoSans}.chart-card{padding:1rem;background:#fff;height:100%}.chart-card .chart-header{font-size:1.4rem;color:#101010;line-height:1.5em;padding:.4rem}.chart-card .chart-header .chart-title-label{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;line-height:1.5em}.chart-card .chart-header .custom-tool-box{text-align:right;display:flex;align-items:center;justify-content:flex-end}.chart-card .chart-body{position:relative;height:calc(100% - 2.9rem)}.chart-card .chart-body.chart-body-full{height:100%}.chart-card .chart-body .customToolBox{display:flex;align-items:center;position:absolute;z-index:2;right:3.5rem;top:-.3rem;min-height:3.2rem}.chart-card .chart-body .customToolBox>bcac-icon{font-size:2.2rem}.chart-card .echarts{width:100%;height:100%!important}.chart-card .echartfontsize{font-size:1.2rem}"]
                }] }
    ];
    /** @nocollapse */
    RingPieComponent.ctorParameters = function () { return [
        { type: ChartResizeService },
        { type: RingPieService }
    ]; };
    RingPieComponent.propDecorators = {
        bcacDarkMode: [{ type: Input }],
        bcacSmallMode: [{ type: Input }],
        bcacTitleSwitch: [{ type: Input }],
        bcacTitle: [{ type: Input }],
        bcacChartShowToolbox: [{ type: Input }],
        bcacChartData: [{ type: Input }],
        bcacChartDataTotal: [{ type: Input }],
        bcacChartName: [{ type: Input }],
        bcacChartColor: [{ type: Input }],
        bcacChartLoading: [{ type: Input }],
        bcacDataSourceList: [{ type: Input }],
        bcacDataSourceSelectEmit: [{ type: Output }]
    };
    return RingPieComponent;
}());
export { RingPieComponent };
if (false) {
    /** @type {?} */
    RingPieComponent.prototype.chartTitleColor;
    /** @type {?} */
    RingPieComponent.prototype.chartTitle;
    /** @type {?} */
    RingPieComponent.prototype.customToolBox;
    /** @type {?} */
    RingPieComponent.prototype.optionInit;
    /** @type {?} */
    RingPieComponent.prototype.options;
    /** @type {?} */
    RingPieComponent.prototype.cardBgColor;
    /** @type {?} */
    RingPieComponent.prototype.fontColor;
    /** @type {?} */
    RingPieComponent.prototype.cardPadding;
    /** @type {?} */
    RingPieComponent.prototype.bcacChart;
    /** @type {?} */
    RingPieComponent.prototype._bcacChartLoading;
    /** @type {?} */
    RingPieComponent.prototype.dataSourceSelectData;
    /** @type {?} */
    RingPieComponent.prototype.bcacDataSourceSelectEmit;
    /** @type {?} */
    RingPieComponent.prototype.chartOption;
    /**
     * @type {?}
     * @private
     */
    RingPieComponent.prototype.chartResizeService;
    /**
     * @type {?}
     * @private
     */
    RingPieComponent.prototype.ringPieService;
}
//# sourceMappingURL=data:application/json;base64, 