import { c as ChartAssemblyInput, I as InstantiateContext, h as ChartWarning, g as ChartTemplateDef } from '../types-DHaPWLqG.js'; import { a as PivotSurface, c as TransformSurface } from '../pivot-CSHA3Pr8.js'; import { R as RecommendChartTypesOptions, b as RecommendedChart } from '../chart-type-recommendation-CAi7zDdQ.js'; /** * Chart.js chart assembly — Two-Stage Pipeline Coordinator. * * Reuses the **same core analysis pipeline** as Vega-Lite and ECharts: * 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 (Chart.js-specific): * template.instantiate → builds Chart.js config structure * cjsApplyLayoutToSpec → applies layout decisions to config * * Key structural differences from ECharts / VL output: * VL: { mark, encoding, data: {values}, width, height } * EC: { xAxis, yAxis, series: [{type, data}], tooltip, legend, grid } * CJS: { type, data: { labels, datasets[] }, options: { scales, plugins } } * * This module has NO React, Redux, or UI framework dependencies. */ /** * Assemble a Chart.js config object. * * ```ts * const config = assembleChartjs({ * data: { values: myRows }, * semantic_types: { weight: 'Quantity' }, * chart_spec: { chartType: 'Bar Chart', encodings: { x: { field: 'category' }, y: { field: 'value' } } }, * options: { addTooltips: true }, * }); * ``` * * @returns A Chart.js config object with optional `_warnings` and `_width`/`_height` hints */ declare function assembleChartjs(input: ChartAssemblyInput): any; /** Inspect the Chart.js legacy (composed) view transformation surface for an input. */ declare function getChartjsPivot(input: ChartAssemblyInput): PivotSurface | undefined; /** Inspect the Chart.js two-control transform surface for an input. */ declare function getChartjsTransform(input: ChartAssemblyInput): TransformSurface | undefined; /** * ============================================================================= * PHASE 2: INSTANTIATE SPEC — Chart.js backend * ============================================================================= * * Translates semantic decisions (Phase 0) and layout dimensions (Phase 1) * into Chart.js-specific config properties. * * Key differences from ECharts/Vega-Lite instantiation: * - CJS uses { type, data: { labels, datasets[] }, options: { scales } } * - CJS scales use 'x'/'y' keys (not xAxis/yAxis) * - CJS sizing via canvas element dimensions + responsive: false * - CJS label rotation via scales[axis].ticks.maxRotation * - CJS stacking via stacked property on scales * - CJS bar sizing via barPercentage and categoryPercentage * * CJS dependency: **Yes — this is where Chart.js-specific syntax lives** * ============================================================================= */ /** * Phase 2: Apply layout and semantic decisions to the Chart.js config object. * * Handles common Chart.js plumbing across all templates: * - Canvas sizing (_width, _height) * - Axis label rotation and font sizing * - Bar sizing (barPercentage, categoryPercentage) * - Overflow truncation warnings */ declare function cjsApplyLayoutToSpec(config: any, context: InstantiateContext, warnings: ChartWarning[]): void; /** * Apply tooltips to a Chart.js config. * Chart.js tooltips are configured under options.plugins.tooltip. */ declare function cjsApplyTooltips(config: any): void; /** * Chart.js template registry. * * Mirrors the structure of echarts/templates/index.ts and * vegalite/templates/index.ts but with Chart.js template definitions. */ /** * Chart.js chart template definitions, grouped by category. */ declare const cjsTemplateDefs: { [key: string]: ChartTemplateDef[]; }; /** * Flat list of all Chart.js chart template definitions. */ declare const cjsAllTemplateDefs: ChartTemplateDef[]; /** * Look up a Chart.js chart template definition by chart type name. */ declare function cjsGetTemplateDef(chartType: string): ChartTemplateDef | undefined; /** * Get the available channels for a Chart.js chart type. */ declare function cjsGetTemplateChannels(chartType: string): string[]; declare function cjsAdaptChart(sourceType: string, targetType: string, encodings: Record, data?: any[], semanticTypes?: Record): Record; declare function cjsRecommendEncodings(chartType: string, data: any[], semanticTypes: Record): Record; /** * Recommend a ranked list of Chart.js chart types for a dataset, restricted to * chart types Chart.js can render. See {@link cjsRecommendCharts} for the * one-step variant that also fills channels. */ declare function cjsRecommendChartTypes(data: any[], semanticTypes: Record, options?: Omit): string[]; /** * One-step recommendation: rank Chart.js chart types for the data, then populate * each with {@link cjsRecommendEncodings}. Suggestions whose required channels * cannot be filled are dropped, so every returned chart is renderable. */ declare function cjsRecommendCharts(data: any[], semanticTypes: Record, options?: Omit): RecommendedChart[]; export { assembleChartjs, cjsAdaptChart, cjsAllTemplateDefs, cjsApplyLayoutToSpec, cjsApplyTooltips, cjsGetTemplateChannels, cjsGetTemplateDef, cjsRecommendChartTypes, cjsRecommendCharts, cjsRecommendEncodings, cjsTemplateDefs, getChartjsPivot, getChartjsTransform };