import { c as ChartAssemblyInput, I as InstantiateContext, h as ChartWarning, g as ChartTemplateDef } from '../types-DHaPWLqG.cjs'; import { a as PivotSurface, c as TransformSurface } from '../pivot-CwI9D70d.cjs'; import { R as RecommendChartTypesOptions, b as RecommendedChart } from '../chart-type-recommendation-CAi7zDdQ.cjs'; /** * ECharts chart assembly — Two-Stage Pipeline Coordinator. * * Reuses the **same core analysis pipeline** as Vega-Lite: * Phase 0: resolveChannelSemantics → ChannelSemantics * Step 0a: declareLayoutMode → LayoutDeclaration * Step 0b: convertTemporalData → converted data * Step 0c: filterOverflow → filtered data, nominalCounts * Phase 1: computeLayout → LayoutResult * * Then diverges for Phase 2 (ECharts-specific): * template.instantiate → builds ECharts option structure * ecApplyLayoutToSpec → applies layout decisions to option * * ── Backend Translation Responsibilities ──────────────────────────── * The LayoutResult from Phase 1 is target-agnostic. This assembler is * responsible for translating it into ECharts-specific structures: * * subplotWidth / subplotHeight * → ECharts `grid.width` / `grid.height` (the inner plot area). * The assembler adds ECharts-specific margins (CANVAS_BUFFER, * axis label space, legend width) to compute the outer canvas * `_width` / `_height`. * * xStep / yStep / stepPadding * → ECharts `barWidth`, `barCategoryGap`, `barGap` on series. * VL handles this via `width: {step: N}` natively; ECharts has * no such declarative feature, so we compute explicit pixel * values from the layout numbers. * * Facet wrapping * → Column wrapping is decided by filterOverflow (shared with VL). * This assembler reads `overflowResult.facetGrid` for the grid * dimensions, restructures the flat 1×N panels into a wrapped * 2D grid, and passes the result to ecCombineFacetPanels. * The combiner itself has NO wrapping logic — it renders * whatever grid it receives. * * Per-panel vs shared axis titles * → The facet combiner keeps Y-axis titles on the left column only * and renders the X-axis title as a shared centered element. * * Key structural differences from Vega-Lite output: * VL: { mark, encoding, data: {values}, width, height } * EC: { xAxis, yAxis, series: [{type, data}], tooltip, legend, grid } * * This module has NO React, Redux, or UI framework dependencies. */ /** * Assemble an ECharts option object. * * ```ts * const option = assembleECharts({ * data: { values: myRows }, * semantic_types: { weight: 'Quantity' }, * chart_spec: { chartType: 'Bar Chart', encodings: { x: { field: 'category' }, y: { field: 'value' } } }, * options: { addTooltips: true }, * }); * ``` * * @returns An ECharts option object with optional `_warnings` and `_width`/`_height` hints */ declare function assembleECharts(input: ChartAssemblyInput): any; /** Inspect the ECharts legacy (composed) view transformation surface for an input. */ declare function getEChartsPivot(input: ChartAssemblyInput): PivotSurface | undefined; /** Inspect the ECharts two-control transform surface for an input. */ declare function getEChartsTransform(input: ChartAssemblyInput): TransformSurface | undefined; /** * ============================================================================= * PHASE 2: INSTANTIATE SPEC — ECharts backend * ============================================================================= * * Translates semantic decisions (Phase 0) and layout dimensions (Phase 1) * into ECharts-specific option properties. * * Key differences from Vega-Lite instantiation: * - VL uses declarative encoding width: {step: N} — EC uses explicit pixel widths * - VL color schemes are strings — EC uses explicit color arrays * - VL handles zero-baseline via scale.zero — EC uses axis.min / scale=true * - VL temporal formatting uses timeUnit — EC uses axisLabel.formatter * - VL label rotation is axis.labelAngle — EC uses axisLabel.rotate * * EC dependency: **Yes — this is where ECharts-specific syntax lives** * ============================================================================= */ declare function ecApplyLayoutToSpec(option: any, context: InstantiateContext, warnings: ChartWarning[]): void; /** * Apply tooltips to an ECharts option. * ECharts tooltip is typically configured at the top level. * When option._encodingTooltip is set, a Vega-Lite–style formatter (label: value per encoding) is applied. */ declare function ecApplyTooltips(option: any): void; /** * ECharts template registry. * * Mirrors the structure of vegalite/templates/index.ts but with ECharts * template definitions. */ /** * ECharts chart template definitions, grouped by category. * Mirrors vegalite/templates/index.ts so VegaLite test cases can run through ECharts. */ declare const ecTemplateDefs: { [key: string]: ChartTemplateDef[]; }; /** * Flat list of all ECharts chart template definitions. */ declare const ecAllTemplateDefs: ChartTemplateDef[]; /** * Look up an ECharts chart template definition by chart type name. */ declare function ecGetTemplateDef(chartType: string): ChartTemplateDef | undefined; /** * Get the available channels for an ECharts chart type. */ declare function ecGetTemplateChannels(chartType: string): string[]; declare function ecAdaptChart(sourceType: string, targetType: string, encodings: Record, data?: any[], semanticTypes?: Record): Record; declare function ecRecommendEncodings(chartType: string, data: any[], semanticTypes: Record): Record; /** * Recommend a ranked list of ECharts chart types for a dataset, restricted to * chart types ECharts can render. See {@link ecRecommendCharts} for the * one-step variant that also fills channels. */ declare function ecRecommendChartTypes(data: any[], semanticTypes: Record, options?: Omit): string[]; /** * One-step recommendation: rank ECharts chart types for the data, then populate * each with {@link ecRecommendEncodings}. Suggestions whose required channels * cannot be filled are dropped, so every returned chart is renderable. */ declare function ecRecommendCharts(data: any[], semanticTypes: Record, options?: Omit): RecommendedChart[]; export { assembleECharts, ecAdaptChart, ecAllTemplateDefs, ecApplyLayoutToSpec, ecApplyTooltips, ecGetTemplateChannels, ecGetTemplateDef, ecRecommendChartTypes, ecRecommendCharts, ecRecommendEncodings, ecTemplateDefs, getEChartsPivot, getEChartsTransform };