import { AfterViewInit, ElementRef, OnDestroy, TemplateRef } from '@angular/core'; import * as echarts from 'echarts'; import type { EChartsOption } from 'echarts'; import * as i0 from "@angular/core"; export type WidgetChartV2Options = EChartsOption; /** Gridstack widget position/size. Used to compute responsive legend layout. */ export interface WidgetDimensions { x: number; y: number; w: number; h: number; } export type WidgetChartV2ErrorContext = { $implicit: string; error: unknown; }; /** Emitted when user triggers Filter In / Filter Out from chart context menu or legend hover. */ export interface ChartContextMenuEvent { action: 'filter-in' | 'filter-out'; /** Data label as displayed in the chart */ name: string; value: number; seriesName: string; dataIndex: number; source: 'chart-element' | 'legend'; } /** * Enhanced chart widget (v2) — raw ECharts wrapper with brand styling. * * Key differences from v1 (`ui-widget-chart`): * - Raw echarts (not ngx-echarts) — full control over init, dispose, resize * - Theme as input signal ('dark'|'light') — no DOM sniffing * - SVG renderer for CSS integration and quality * - Geographic chart support (lazy-loaded world map) * - ResizeObserver-based responsive sizing * - Dataset merging for reactive data updates * - Custom error template support * - Brand color palette opt-in via `applyBrandColors` input (defaults to false) * * Uses same color palette, typography, and styling as v1's `optionsForWidget()`. */ export declare class WidgetChartV2Component implements AfterViewInit, OnDestroy { private _http; private static _worldMapLoaded; private static _themesRegistered; /** ECharts options — full chart configuration */ options: import("@angular/core").InputSignal; /** Data for ECharts dataset — merged into options.dataset.source */ data: import("@angular/core").InputSignal; /** External loading state */ loading: import("@angular/core").InputSignal; /** Disable interactive events (click, legend, datazoom) */ readOnly: import("@angular/core").InputSignal; /** * Theme: 'dark' or 'light'. * Maps to ECharts registered theme names: 'dark' → 'stellar-dark', 'light' → 'stellar'. * Parent component resolves the theme and passes the string here. */ theme: import("@angular/core").InputSignal<"dark" | "light">; /** Custom error template — receives { $implicit: errorMessage, error: rawError } */ errorTemplate: import("@angular/core").InputSignal | null>; /** Custom empty state message */ emptyMessage: import("@angular/core").InputSignal; /** * When true (default), chart fills container. * When false, donut/pie charts are locked to 540×304 design size. */ fillContainer: import("@angular/core").InputSignal; /** Print/PDF mode — disables animation, uses white background */ printOptimized: import("@angular/core").InputSignal; /** Chart type hint — used for donut constrained sizing */ chartType: import("@angular/core").InputSignal; /** * When true, the brand color palette is auto-applied to options that don't * specify a top-level `color` array. Defaults to false — generators typically * set colors at the series/item level, so auto-injection would override them. * Set to true only when using ui-kit's option builders or raw options without colors. */ applyBrandColors: import("@angular/core").InputSignal; /** * Gridstack widget dimensions {x, y, w, h}. * Drives responsive legend placement: * - ≤2×2: legend hidden * - ~3×3: horizontal scrolling legend at bottom * - Wide (w > h): vertical legend on the right * - Tall (h >= w): horizontal legend at bottom */ widgetDimensions: import("@angular/core").InputSignal; /** * Color palette identifier. Maps to a registered ECharts theme name. * E.g., 'stellar' → theme 'stellar'/'stellar-dark', 'ocean' → 'ocean'/'ocean-dark'. * Default: 'stellar'. */ palette: import("@angular/core").InputSignal; /** When true, right-click context menu and legend hover filter icons are shown. */ filterable: import("@angular/core").InputSignal; /** Emitted when ECharts instance is initialized */ chartInit: import("@angular/core").OutputEmitterRef; /** Emitted on click / select events (if not readOnly) */ chartClick: import("@angular/core").OutputEmitterRef; /** Emitted on legend / datazoom / brush events (if not readOnly) */ chartFilter: import("@angular/core").OutputEmitterRef; /** Emitted when chart rendering fails */ chartError: import("@angular/core").OutputEmitterRef; /** Emitted when user clicks Filter In / Filter Out from context menu or legend overlay. */ contextMenuAction: import("@angular/core").OutputEmitterRef; chartContainer: import("@angular/core").Signal | undefined>; private readonly _chartInstance; private readonly _rendering; private readonly _errorMessage; private readonly _error; private readonly _hasLoaded; private readonly _activeTheme; private _resizeObserver?; private _windowResizeHandler?; private _axisLabelTooltip?; private _contextMenu?; private _contextMenuParams; private _dismissHandlers; private _legendOverlay?; private _hoveredLegendParams; protected echartsTheme: import("@angular/core").Signal; protected readonly isBusy: import("@angular/core").Signal; /** True when loading but chart already has content — skip overlay to avoid flash/blur */ protected readonly isRefreshing: import("@angular/core").Signal; protected readonly hasError: import("@angular/core").Signal; protected readonly errorContext: import("@angular/core").Signal; protected readonly shouldHideCanvas: import("@angular/core").Signal; protected readonly isEmpty: import("@angular/core").Signal; protected readonly emptyIcon: import("@angular/core").Signal<"pi pi-chart-bar" | "pi pi-chart-pie" | "pi pi-map" | "pi pi-chart-line">; protected readonly isConstrainedDonut: import("@angular/core").Signal; constructor(); ngAfterViewInit(): Promise; ngOnDestroy(): void; /** * Dispose the current chart and re-create it with the current theme. * Called when the theme input changes after initial render. */ private _reinitChart; /** * Merge options + data + brand defaults into a single EChartsOption. * Applies chart-type-aware styling for tooltip, series, legend, etc. */ private _buildEffectiveOptions; /** * Check if chart data is effectively empty across all series. * Returns true when options exist but contain no meaningful data to render. */ private _isDataEmpty; /** * Resolve theme-aware text colors. * Reads CSS custom properties when available, falls back to hardcoded values. */ private _getTextColors; /** * Resolve theme-aware tooltip styling. * Reads CSS custom property for overlay background, falls back to config. */ private _getTooltipStyle; /** * Apply chart-type defaults to options. * Consumer-provided values always win — defaults only fill gaps. */ private _applyChartTypeDefaults; /** * Detect chart type from the chartType input or from the series config. */ private _detectChartType; /** * Count distinct data items across all series (for pie: data[].length, * for cartesian: number of series names or category count). */ private _countDataItems; /** * Compute donut radius [inner%, outer%] so the ring has a constant * pixel thickness regardless of container size. * * outerRadius is fixed at WIDGET_CHART_V2_STYLES.donut.outerRadius %. * innerRadius is derived: outer% − (ringThicknessPx / halfMinDim) × 100. */ private _computeDonutRadius; /** * Resolve legend layout from gridstack widget dimensions. * * Rules: * - ≤2 in either w or h → hidden (too small for a legend) * - 3×3 (area ≤ 9) → horizontal scrolling at bottom * - w > h (landscape) → vertical legend on the right * - h >= w (portrait/sq) → horizontal legend at bottom */ private _resolveLegendLayout; /** * Build ECharts legend config for the resolved layout. */ private _buildLegendConfig; /** * Build a map of legend item name → numeric value from chart series data. * For pie/donut: each data item's value. For cartesian: sum per series. */ private _buildLegendValueMap; /** Format a numeric value compactly for legend display. */ private _formatLegendValue; /** * Enrich legend config with value labels (via rich-text formatter) * and tooltip for truncated text. */ private _enrichLegendWithValues; /** * Calculate max legend label characters based on actual container size and layout. * Adapts dynamically as the widget is resized. */ private _calcMaxLegendChars; /** * Apply donut-specific defaults: radius, center, padAngle, emphasis, legend. */ private _applyDonutDefaults; /** * Patch graphic elements in donut charts: * - Reposition center label group to match donut center * - Fix text fill colors for dark/light theme (CSS vars don't work in SVG renderer) */ /** * Find the actual center of the main pie series (not the ghost total-label series). */ private _findDonutSeriesCenter; /** * Convert graphic center-label into a ghost pie series with position:'center' label. * ECharts natively centers pie labels in the donut hole — no manual positioning needed. * Removes the graphic element entirely. */ private _patchDonutGraphic; /** * Apply bar-specific defaults: barWidth, borderRadius, axis label colors. */ private _applyBarDefaults; /** * Apply line/area-specific defaults: lineWidth, symbolSize, area gradient. */ private _applyLineDefaults; /** * Apply dimension-based legend for cartesian (bar/line) charts. * Always overrides legend position and adjusts grid to make room. */ private _applyCartesianLegend; /** * Patch xAxis/yAxis label and line colors if not already set. */ private _patchAxisColors; /** * Merge external data into the options.dataset.source field. */ private _mergeDataset; private _applyOptions; private static readonly _VALID_SERIES_TYPES; private static readonly _VALID_AXIS_TYPES; /** * Validate ECharts options and log detailed warnings/errors. * Does NOT throw — charts will still attempt to render so ECharts can surface * its own errors. This catches common misconfigurations early with actionable messages. */ private _validateOptions; /** * Validate xAxis or yAxis configuration */ private _validateAxis; private _checkIfGeographicChart; private _isGeographicOptions; private _ensureWorldMapLoaded; private _bindEvents; private _emitIfInteractive; private _showAxisLabelTooltip; private _hideAxisLabelTooltip; private _destroyAxisLabelTooltip; private _showContextMenu; private _hideContextMenu; private _destroyContextMenu; private _emitContextMenuAction; private _bindDismissHandlers; private _unbindDismissHandlers; private _showLegendOverlay; private _hideLegendOverlay; private _destroyLegendOverlay; private _observeResize; private _clearError; private _setError; private _extractErrorMessage; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }