/** * DOCX Module - Template Chart Data Binding * * Extends the template engine with chart data binding support. * Allows replacing series data, categories, and titles in chart * definitions within a DocxDocument. * * @stability experimental */ import type { DocxDocument } from "../types.js"; /** Data for a single chart series to bind. */ export interface ChartSeriesData { /** Series name (legend label). */ readonly name: string; /** Numeric data values. */ readonly values: number[]; /** Optional series color (6-digit hex RGB). */ readonly color?: string; } /** Binding specification mapping a chart reference to new data. */ export interface ChartBinding { /** Chart index (0-based) or chart name. */ readonly chartRef: number | string; /** New series data. */ readonly series: ChartSeriesData[]; /** New category labels (X-axis). */ readonly categories?: string[]; /** Chart title override. */ readonly title?: string; } /** Aggregate template data for chart bindings. */ export interface ChartTemplateData { /** Array of chart bindings to apply. */ readonly charts: ChartBinding[]; } /** * Replace chart data in a DocxDocument according to the provided bindings. * * Iterates through the document body, locates `ChartContent` blocks, and * replaces their series data, categories, and titles with the values * specified in each binding. * * Charts are matched by either: * - Numeric index (0-based position among all ChartContent blocks in body) * - String name (matched against `ChartContent.name`) * * Only basic chart types (bar, column, line, pie and their variants) are * supported. Bindings that reference unsupported chart types are skipped. * * @param doc - The DocxDocument to modify. * @param chartBindings - Array of chart bindings to apply. * @returns A new DocxDocument with chart data replaced. * * @stability experimental */ export declare function bindChartData(doc: DocxDocument, chartBindings: ChartBinding[]): DocxDocument;