import * as i0 from '@angular/core'; import { OnInit, OnDestroy, TemplateRef, OnChanges, ElementRef, SimpleChanges } from '@angular/core'; import { KPIDetails } from '@c8y/ngx-components/datapoint-selector'; import { Observable } from 'rxjs'; import { ECharts } from 'echarts/core'; import { DynamicComponent, DynamicComponentAlertAggregator } from '@c8y/ngx-components'; import { EChartsOption } from 'echarts'; /** * Configuration interface for the Pie Chart widget. * Stored in the widget's config property on the dashboard. */ interface PieChartConfig { /** Display options for the pie chart */ pieChartOptions: PieChartOptions; /** Array of datapoints to display in the chart */ datapoints: KPIDetails[]; } /** * Display options for the Pie Chart widget. */ interface PieChartOptions { /** Show percentage labels inside pie slices */ showLabels: boolean; /** Show legend with datapoint names */ showLegend: boolean; /** Show tooltips on hover with value and unit */ showTooltips: boolean; } declare class PieChartWidgetConfigComponent implements OnInit, OnDestroy { config: PieChartConfig; formGroup: ReturnType; differentUnits: boolean; private readonly destroy$; set previewMapSet(template: TemplateRef); private readonly widgetConfigService; private readonly formBuilder; ngOnInit(): void; ngOnDestroy(): void; onBeforeSave(config?: PieChartConfig): boolean | Promise | Observable; private initForm; private subscribeToDatapointsChanges; /** * Checks if selected datapoints have different units and sets warning flag. * Different units in a pie chart can be misleading to users. * * @param datapoints - Array of selected datapoints to check */ private checkUnitsMatch; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class PieChartWidgetViewComponent implements OnChanges, DynamicComponent { config: PieChartConfig; chart: ElementRef; activeDatapoints: KPIDetails[]; chartOptions$: Observable; alerts: DynamicComponentAlertAggregator; echartsInstance: ECharts; private readonly configChanged$; private readonly measurements; private readonly translateService; constructor(); ngOnChanges(_: SimpleChanges): void; onChartInit(ec: ECharts): void; /** * Fetches latest measurements for all configured datapoints. */ private fetchMeasurements; /** * Maps a datapoint and its measurement to a DatapointValue. */ private mapToDatapointValue; /** * Handles negative value alerts - clears existing alerts and adds warning if needed. */ private handleNegativeValues; /** * Builds the ECharts options based on datapoint values. */ private buildChartOptions; /** * Checks if chart should display empty state (no positive data). */ private isEmptyState; /** * Builds options for empty state display. */ private buildEmptyStateOptions; /** * Builds the pie chart options with data. */ private buildPieChartOptions; /** * Calculates total of all entry values. */ private calculateTotal; /** * Builds tooltip configuration. */ private buildTooltipConfig; /** * Builds legend configuration. */ private buildLegendConfig; /** * Builds pie series configuration. */ private buildPieSeriesConfig; /** * Formats percentage label for pie slice. */ private formatPercentageLabel; /** * Updates the ECharts instance with new options. */ private updateChartInstance; /** * Encodes HTML to prevent XSS attacks. */ private encodeHtml; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export { PieChartWidgetConfigComponent, PieChartWidgetViewComponent }; //# sourceMappingURL=index.d.ts.map