import { Chart as ChartJS, Plugin } from 'chart.js'; /** * @description Supported chart types. */ export type ChartType = "line" | "bar" | "pie" | "doughnut" | "radar" | "polarArea"; /** * @description Data structure for chart components. * Defines the structure for chart data including labels and datasets with their configuration. * * @typedef {Object} ChartData * @property {string[]} labels - Optional array of labels for chart data points. * @property {Array} datasets - Array of dataset objects containing chart data and styling. * @property {string} datasets.label - Optional label for the dataset. * @property {number[]} datasets.data - Array of numerical data points for the dataset. * @property {string | string[]} datasets.backgroundColor - Background color(s) for data points. * @property {string | string[]} datasets.borderColor - Border color(s) for data points. * @property {number} datasets.borderWidth - Width of borders around data points. * @property {boolean} datasets.fill - Whether to fill the area under line charts. * @property {number} datasets.tension - Tension for curved lines in line charts. * @property {ChartType} datasets.type - Override chart type for mixed charts. */ export type ChartData = { labels?: string[]; datasets: Array<{ label?: string; data: any[]; backgroundColor?: string | string[]; borderColor?: string | string[]; borderWidth?: number; fill?: boolean; tension?: number; type?: ChartType; [key: string]: any; }>; }; /** * @description Configuration options for chart components. * Defines the available configuration options for customizing chart appearance and behavior. * * @typedef {Object} ChartOptions * @property {boolean} responsive - Whether the chart should be responsive to container size changes. * @property {boolean} maintainAspectRatio - Whether to maintain the chart's aspect ratio when resizing. * @property {Object} plugins - Configuration for chart plugins. * @property {Object} plugins.legend - Legend configuration options. * @property {boolean} plugins.legend.display - Whether to display the legend. * @property {('top' | 'bottom' | 'left' | 'right')} plugins.legend.position - Position of the legend. * @property {any} plugins.legend.labels - Legend label configuration. * @property {Object} plugins.title - Title configuration options. * @property {boolean} plugins.title.display - Whether to display the title. * @property {string} plugins.title.text - Text content for the title. * @property {any} plugins.tooltip - Tooltip configuration options. * @property {Object} scales - Scale configuration for chart axes. * @property {any} scales.x - X-axis scale configuration. * @property {any} scales.y - Y-axis scale configuration. * @property {('x' | 'y')} indexAxis - Which axis to use as the index axis for horizontal charts. */ export type ChartOptions = { responsive?: boolean; maintainAspectRatio?: boolean; plugins?: { legend?: { display?: boolean; position?: "top" | "bottom" | "left" | "right"; labels?: any; }; title?: { display?: boolean; text?: string; }; tooltip?: any; }; scales?: { x?: any; y?: any; [key: string]: any; }; indexAxis?: "x" | "y"; [key: string]: any; }; /** * Simple color manipulation functions */ export declare const adjustColor: (color: string, lighten: number, darken: number) => string; /** * Helper function to convert hex to rgba */ export declare const hexToRgba: (hex: string, alpha?: number) => string; /** * Chart.js plugin for polar area radial gradients */ export declare const polarAreaGradientPlugin: Plugin; /** * Configuration utility functions */ export declare const chartConfigUtils: { /** * Process chart data to apply fade effects */ processChartData: (type: ChartType, data: ChartData, fadeIntensity?: number | string) => ChartData; /** * Create radial gradients for pie and doughnut charts */ createRadialGradients: (type: ChartType, data: ChartData, canvas: HTMLCanvasElement, fadeIntensity?: number | string) => ChartData; }; interface RuneChartPluginOptions { colors?: string[]; cssVariables?: { background?: string; text?: string; border?: string; tooltip?: { background?: string; text?: string; }; }; darkModeDetection?: { attribute?: string; target?: "html" | "body"; }; } /** * Registers the Rune Chart.js plugin and updates default styles to support dark mode. * Will automatically switch colors and styles when dark mode is toggled. * * @param chart - Chart.js Chart constructor * @param options - Plugin configuration options * * @example * ```ts * import { registerRuneChartPlugin } from './RuneChart'; * import { Chart, registerables } from 'chart.js'; * * Chart.register(...registerables); * registerRuneChartPlugin(Chart); * ``` */ export declare const registerRuneChartPlugin: (chart: typeof ChartJS, options?: RuneChartPluginOptions) => void; export {};