import { __decorate, __metadata } from "tslib";
import { ChangeDetectorRef, Component, ElementRef, Inject, Input, NgZone, PLATFORM_ID, } from '@angular/core';
import { PolarChartComponent, LegendPosition } from '@swimlane/ngx-charts';
import { MonitoringAppGenComponent, } from '../../metadata/decorators';
import { ChartDataModel, } from '../ChartDataModel';
import { dataWithSeriesToCsv } from '../ExportDataFormat';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@swimlane/ngx-charts";
import * as i3 from "@ionic/angular";
import * as i4 from "../../ui-directive/export-data.directive";
let TapVariablePolarRadarChartComponent = class TapVariablePolarRadarChartComponent extends PolarChartComponent {
    set variable(variableOrArray) {
        this.input = this.chartModel.initVariable(variableOrArray);
    }
    set input(inputs) {
        this.subscription = this.chartModel
            .defineMultiInputStream(inputs)
            .subscribe((result) => {
            this.results = result;
            this.loaded = true;
        });
    }
    constructor(myChartElement, zone, platformId, cd) {
        super(myChartElement, zone, cd, platformId);
        this.colorScheme = {
            domain: [
                '#5DADE2',
                '#9B59B6',
                '#F39C12',
                '#5AA454',
                '#A10A28',
                '#C7B42C',
                '#AAAAAA',
            ],
        };
        this.legend = true;
        this.legendPosition = LegendPosition.Below;
        this.showExportButton = false;
        this.xAxis = true;
        this.showXAxisLabel = true;
        this.yAxis = true;
        this.showYAxisLabel = true;
        this.valueCountLimit = 4;
        this.loaded = false;
        this.results = [
            {
                name: 'Value',
                series: [],
            },
        ];
        this.chartModel = new ChartDataModel();
    }
    createExportedData() {
        return dataWithSeriesToCsv(this.results);
    }
    ngOnDestroy() {
        this.subscription?.unsubscribe();
        this.chartModel.destroyCurrentSub();
    }
    onSelect(event) {
        /* Not implemented
        this.chartModel.showDetail(event, this.modalController, TapVariableDataPopupComponent);
        */
    }
};
/** @nocollapse */ TapVariablePolarRadarChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapVariablePolarRadarChartComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
/** @nocollapse */ TapVariablePolarRadarChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TapVariablePolarRadarChartComponent, selector: "tap-variable-polar-radar-chart", inputs: { colorScheme: "colorScheme", legend: "legend", legendPosition: "legendPosition", showExportButton: "showExportButton", exportedFileName: "exportedFileName", xAxis: "xAxis", showXAxisLabel: "showXAxisLabel", yAxis: "yAxis", showYAxisLabel: "showYAxisLabel", valueCountLimit: "valueCountLimit", variable: "variable", input: "input" }, usesInheritance: true, ngImport: i0, template: "<div\n  #containerRef\n  [ngClass]=\"legendPosition === 'below' ? 'belowLegend' : 'rightLegend'\"\n  style=\"position: relative\"\n>\n  <ngx-charts-polar-chart\n    *ngIf=\"loaded\"\n    #polarChart\n    [view]=\"[containerRef.offsetWidth, containerRef.offsetHeight]\"\n    [scheme]=\"colorScheme\"\n    [legend]=\"legend\"\n    [legendPosition]=\"legendPosition\"\n    [showXAxisLabel]=\"showXAxisLabel\"\n    [showYAxisLabel]=\"showYAxisLabel\"\n    [xAxis]=\"xAxis\"\n    [yAxis]=\"yAxis\"\n    [results]=\"results\"\n    (select)=\"onSelect($event)\"\n  >\n  </ngx-charts-polar-chart>\n  <ion-fab-button\n    id=\"exportFabButton\"\n    size=\"small\"\n    tapExportData\n    *ngIf=\"showExportButton\"\n    [exportedFileName]=\"exportedFileName\"\n    [dataToExport]=\"createExportedData.bind(this)\"\n  >\n    <ion-icon name=\"download\"></ion-icon>\n  </ion-fab-button>\n</div>\n", styles: ["::ng-deep .horizontal-legend{overflow:auto!important}.belowLegend{height:50vh;width:100%;margin-bottom:100px}.rightLegend{height:50vh;width:100%}#exportFabButton{position:absolute;top:10px;right:10px}@media (prefers-color-scheme: dark){::ng-deep span.legend-label-text{color:#ccc!important}::ng-deep span.legend-label-text:hover{color:#fff!important}::ng-deep .ngx-charts text{fill:#fff!important}}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.PolarChartComponent, selector: "ngx-charts-polar-chart", inputs: ["legend", "legendTitle", "legendPosition", "xAxis", "yAxis", "showXAxisLabel", "showYAxisLabel", "xAxisLabel", "yAxisLabel", "autoScale", "showGridLines", "curve", "activeEntries", "schemeType", "rangeFillOpacity", "trimYAxisTicks", "maxYAxisTickLength", "xAxisTickFormatting", "yAxisTickFormatting", "roundDomains", "tooltipDisabled", "showSeriesOnHover", "gradient", "yAxisMinScale", "labelTrim", "labelTrimSize", "wrapTicks"], outputs: ["activate", "deactivate"] }, { kind: "component", type: i3.IonFabButton, selector: "ion-fab-button", inputs: ["activated", "closeIcon", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "show", "size", "target", "translucent", "type"] }, { kind: "component", type: i3.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "directive", type: i4.ExportDataDirective, selector: "[tapExportData]", inputs: ["exportedFileName", "dataToExport", "format"], outputs: ["exportDataError"] }] });
TapVariablePolarRadarChartComponent = __decorate([
    MonitoringAppGenComponent({
        constraints: {
            isNumber: 'YES',
        },
    }),
    __metadata("design:paramtypes", [ElementRef,
        NgZone, String, ChangeDetectorRef])
], TapVariablePolarRadarChartComponent);
export { TapVariablePolarRadarChartComponent };
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TapVariablePolarRadarChartComponent, decorators: [{
            type: Component,
            args: [{ selector: 'tap-variable-polar-radar-chart', template: "<div\n  #containerRef\n  [ngClass]=\"legendPosition === 'below' ? 'belowLegend' : 'rightLegend'\"\n  style=\"position: relative\"\n>\n  <ngx-charts-polar-chart\n    *ngIf=\"loaded\"\n    #polarChart\n    [view]=\"[containerRef.offsetWidth, containerRef.offsetHeight]\"\n    [scheme]=\"colorScheme\"\n    [legend]=\"legend\"\n    [legendPosition]=\"legendPosition\"\n    [showXAxisLabel]=\"showXAxisLabel\"\n    [showYAxisLabel]=\"showYAxisLabel\"\n    [xAxis]=\"xAxis\"\n    [yAxis]=\"yAxis\"\n    [results]=\"results\"\n    (select)=\"onSelect($event)\"\n  >\n  </ngx-charts-polar-chart>\n  <ion-fab-button\n    id=\"exportFabButton\"\n    size=\"small\"\n    tapExportData\n    *ngIf=\"showExportButton\"\n    [exportedFileName]=\"exportedFileName\"\n    [dataToExport]=\"createExportedData.bind(this)\"\n  >\n    <ion-icon name=\"download\"></ion-icon>\n  </ion-fab-button>\n</div>\n", styles: ["::ng-deep .horizontal-legend{overflow:auto!important}.belowLegend{height:50vh;width:100%;margin-bottom:100px}.rightLegend{height:50vh;width:100%}#exportFabButton{position:absolute;top:10px;right:10px}@media (prefers-color-scheme: dark){::ng-deep span.legend-label-text{color:#ccc!important}::ng-deep span.legend-label-text:hover{color:#fff!important}::ng-deep .ngx-charts text{fill:#fff!important}}\n"] }]
        }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [PLATFORM_ID]
                }] }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { colorScheme: [{
                type: Input
            }], legend: [{
                type: Input
            }], legendPosition: [{
                type: Input
            }], showExportButton: [{
                type: Input
            }], exportedFileName: [{
                type: Input
            }], xAxis: [{
                type: Input
            }], showXAxisLabel: [{
                type: Input
            }], yAxis: [{
                type: Input
            }], showYAxisLabel: [{
                type: Input
            }], valueCountLimit: [{
                type: Input
            }], variable: [{
                type: Input
            }], input: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 