import { type VariantProps } from 'class-variance-authority'; import '../../tokens/apexcharts-theme.css'; declare const chartVariants: (props?: ({ density?: "none" | "comfortable" | "compact" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string; export type ChartType = 'line' | 'bar' | 'pie' | 'donut' | 'area' | 'radialBar'; /** Location in the currently displayed view, including any type-switch adaptation. */ export interface ChartDataPointContext { type: ChartType; /** Axis series index; for a slice chart, the slice index. */ seriesIndex: number; /** Point index within an axis series; for a slice chart, the slice index. */ dataPointIndex: number; /** Axis series name, or slice label when present. */ seriesName?: string; /** Category label, or slice label when present. */ category?: string; /** Value axis the series is plotted on. Always `'primary'` unless `secondaryAxis` is set and the series has `axis: 'secondary'`. */ axis: 'primary' | 'secondary'; } export interface ChartSeries { name: string; data: number[]; /** * Marks this series as a secondary "compare" overlay — e.g. the previous * period in a current-vs-previous financial view. Rendered visually * subordinate and colour-blind-safe, distinguished from primary series by * BOTH a non-colour cue AND a lighter shade of the SAME hue (never colour * alone). The compare series inherits its PAIRED primary's colour (k-th * compare pairs with the k-th primary, by order), then: * - line / area: a round-DOTTED stroke in the paired-primary colour (the * dotted-vs-solid pattern is the non-colour cue); area also gets a tinted * fill at `--chart-compare-fill-opacity`. * - bar: a tinted fill (paired-primary hue at `--chart-compare-fill-opacity`) * under a full-strength DOTTED outline that is OPEN at the baseline — so a * compare bar reads as an outlined "ghost" of its solid primary. * The legend swatch shows the lighter tint (via `legend.markers.fillColors`), * and the series name (e.g. "Revenue (previous period)") remains the primary * signal in the legend and the screen-reader table. * Only meaningful on axis types (line / area / bar); it is structurally * impossible on pie / donut / radialBar (their `series` is `number[]`, which * cannot carry this field), so the axis-only invariant is enforced by the * type system with no runtime guard. On an axis→slice type switch the compare * series are dropped from the slice (a previous-period total is not a slice of * the current whole; DEV warn). Omit (or `'primary'`) to render normally — a * chart with NO compare series renders as before this field existed, and * removing or moving the role through `series` clears it from the old series. * @default 'primary' */ role?: 'primary' | 'compare'; /** * Which value scale plots this series on an axis chart. `'secondary'` needs * `secondaryAxis` on the Chart; without it the series stays on the primary * scale (DEV warning). Travels with the series through `updateSeries`. * @default 'primary' */ axis?: 'primary' | 'secondary'; } /** Bar orientation. `'horizontal'` renders a ranking sideways. Default `'vertical'`. */ export type ChartOrientation = 'vertical' | 'horizontal'; /** Line / area stroke interpolation. Default `'smooth'`. */ export type ChartCurve = 'smooth' | 'straight' | 'stepline'; /** A second unit, with its own scale at the inline-end of the chart. */ export interface ChartSecondaryAxis { /** Consumer-translated unit label, for example "#". Also labels table rows. */ title: string; /** Formats this unit in axis ticks, tooltips and the summary table. * Defaults to locale-grouped numbers, independently of `valueFormatter`. */ valueFormatter?: (value: number) => string; /** Count axis: ticks that are not whole numbers print as empty text, so * small counts never show "0.5" or a repeated label. Tooltip and table keep * the real formatter. */ integer?: boolean; } export interface ChartProps extends VariantProps { /** Required — drives aria-label and sr-only table caption. */ title: string; /** Opaque instance id — emitted as `data-component-id` for the agent registry. */ id?: string; /** Chart visual type. */ type: ChartType; /** * For `line` / `bar` / `area`: an array of `ChartSeries`. * For `pie` / `donut` / `radialBar`: an array of numbers matched to `labels`. */ series: ChartSeries[] | number[]; /** Category axis labels (line / bar / area). */ categories?: string[]; /** Slice labels (pie / donut / radialBar). */ labels?: string[]; /** Defaults to 320px. A number or `px` is the plot area's ApexCharts height; a * `%` sizes the whole Chart (switcher row, legend, plot) to that share of its * parent's height, at least 160px: `"100%"` fills a definite-height parent. */ height?: number | string; /** Width override. Defaults to 100% of container. */ width?: number | string; /** Opt-in pattern fills for colour-blind users. */ patterns?: boolean; /** * Stack multiple `bar` / `area` series into a composition-over-time view. * Maps to ApexCharts `chart.stacked`. Only applies to the axis types * (`line` / `bar` / `area`); slice types (`pie` / `donut` / `radialBar`) * have no axis to stack against and ignore it. Default `false`: an * unstacked chart renders as before this prop existed, and turning it off * after the first render unstacks the bars in place. */ stacked?: boolean; /** * Orientation for the `bar` type. `'horizontal'` renders the bars sideways * (ApexCharts `plotOptions.bar.horizontal`) for ranking-style charts where * the category is a name and the value runs across the horizontal axis. * Still an axis chart — pass `series` as `ChartSeries[]` with `categories`. * Ignored for every non-`bar` type. Default `'vertical'`. */ orientation?: ChartOrientation; /** * Stroke interpolation for `line` / `area` charts (ApexCharts * `stroke.curve`). `'straight'` avoids the overshoot a smoothed spline * introduces on spiky monthly financials — where a `'smooth'` curve can dip * visually below zero between two positive points. Inert on `bar` (stroke * width is 0) and ignored on slice types. Default `'smooth'` — existing * charts are unaffected. */ curve?: ChartCurve; /** * Override the series colour ramp. Pass **already-resolved** colour strings * (e.g. the live value of `var(--success)` sampled by the consumer) — these * are handed straight to ApexCharts, which can't read CSS custom properties. * When omitted, the theme bridge's `colors` ramp from `apexcharts-theme.ts` * is used, so existing consumers are unaffected. Typical use: a single-arc * `radialBar` gauge (e.g. BMI) that must change hue with the value — * green in the healthy band, amber/red outside it. */ colors?: string[]; /** * Show the ApexCharts toolbar. Its buttons are --min-target-size boxes in a * band reserved above the plot; zoomable types need about 300px of width. * Defaults to false. */ toolbar?: boolean; /** Locale override — defaults to the active i18next language. */ locale?: string; /** * radialBar only. Formats a ring's value: in the centre, in the summary * table and, with several rings, in each ring's legend item. Use when the * gauge represents a non-percentage figure: pass the arc fill (0–100) as the * `series` value and return the real figure here (e.g. `() => '22.4'` for a * single ring). It is called with each ring's own value, so with several * rings it must use that value. Ignored for every other chart type. * Defaults to a percent in the chart's locale. */ radialValueFormatter?: (value: number) => string; /** * Formats the numeric value of each data point wherever it is surfaced as * text — the tooltip, the value (y) axis on categorical charts, and the * screen-reader summary table. Use it to append a unit or currency symbol, * e.g. `(v) => new Intl.NumberFormat(locale, { style: 'currency', currency: * 'EUR' }).format(v)`. Defaults to `Intl.NumberFormat(locale)` (grouped * number, no unit). Does not apply to a `radialBar`: its centre, legend * and summary table use `radialValueFormatter`. */ valueFormatter?: (value: number) => string; /** Primary axis ticks only. Falls back to valueFormatter. The secondary axis uses `secondaryAxis.valueFormatter`. Ignored by slice charts. */ axisValueFormatter?: (value: number) => string; /** * Plain-text point detail for both the tooltip and screen-reader summary. * Receives indices and labels from the displayed view, so equal values can * carry different context. Falls back to the series' axis formatter * (valueFormatter on the primary axis), also when this * throws or returns anything but a non-blank string (a DEV console warning * names the failure). Ignored by radialBar. */ dataPointFormatter?: (value: number, context: ChartDataPointContext) => string; /** Consumer-translated label for the primary value axis, e.g. "Production (€)". */ valueAxisTitle?: string; /** * Options for the independent value scale used by every series with * `axis: 'secondary'`. Vertical line/bar/area only; slice/radial types ignore * it. While configured on an axis chart, stacking and horizontal orientation * are disabled and the type switcher offers only axis types, so unlike units * cannot be stacked or added together as slices. The chart type applies to * all series: a combined bar and line chart is not supported. */ secondaryAxis?: ChartSecondaryAxis; /** * Opt-in type switcher. Pass two or more of `'line' | 'bar' | 'area' | * 'pie' | 'donut'` to render an icon radiogroup (an `IconButtonGroup`) * above the plot that lets the user flip the chart between those types. * `type` is the initial selection and is always offered; the user's pick * then sticks across re-renders (remount with a new `key` to reset it). * When the picked type reads the other data shape, the data adapts: axis * series collapse to one slice per series (that series' total) for `pie` / * `donut`, and slice values become a single-series axis chart with * `labels` as the categories. `radialBar` cannot participate — such * entries are ignored (DEV warning) and a `radialBar` chart never shows * the switcher. */ switchableTypes?: ChartType[]; /** Called when the user picks a different type via the switcher. */ onTypeChange?: (type: ChartType) => void; /** Extra class names on the wrapper. */ className?: string; } export interface ChartHandle { /** Returns a PNG data URI for the chart, after any pushed series is drawn. */ dataURI: () => Promise; /** * Updates series without remounting. Always pass the DECLARED `type`'s * shape — while the user has switched the view across the axis/slice * boundary the values (and, for axis→slice, the slice labels) are * converted to the rendered shape; for slice→axis the categories stay * the `labels` prop, so keep the value count stable. The update also * reaches the summary table, and holds until the `series` prop changes; * `dataURI` waits for it to be drawn. */ updateSeries: (next: ChartProps['series']) => void; /** * Switches the rendered type via the type switcher. Returns `false` * (no-op) when the switcher is not enabled or the type is not offered. */ setType: (next: ChartType) => boolean; /** Declared vs rendered type plus the types the switcher offers ([] when disabled). */ getTypeState: () => { declaredType: ChartType; effectiveType: ChartType; availableTypes: ChartType[]; }; } export declare const Chart: import("react").ForwardRefExoticComponent>; export { chartVariants }; //# sourceMappingURL=chart.d.ts.map