import { CSSProperties, ReactElement, ReactNode } from 'react'; import { ChartLoadingStyle, ChartEmptyState, ChartMotion, ChartPalette, ChartStyle, ChartSurface, CardLegend, ChartLegendSwatch } from '../types'; import { CardRange } from './cartesian-card'; import { NumericKey, TextKey } from './keys'; import { AnimatedNumberVariant } from '../motion/animated-number'; /** How the resting headline sums up every plotted point's `y`. */ export type ScatterAggregate = 'sum' | 'mean' | 'max'; export interface ScatterChartCardProps> { /** Optional visible title. Use aria-label to name an embedded chart. */ title?: string; /** Show the header, including headline and period controls. Defaults to true. */ header?: boolean; /** Accessible name, independent of the visible title. */ 'aria-label'?: string; /** One row per point. Omit when `ranges` supplies the data. */ data?: readonly Row[]; /** Numeric field for the horizontal position. */ x: NumericKey; /** Numeric field for the vertical position. It also drives the headline. */ y: Key; /** Numeric field that sizes each point by area, turning dots into bubbles. */ size?: NumericKey; /** Names the size measure in readouts, e.g. "Reach". */ sizeLabel?: string; /** Text field that colors points by group and adds a legend. */ group?: TextKey; /** Text field that names a point when it is hovered or focused. */ label?: TextKey; /** Axis titles, e.g. "Spend" and "Sign-ups". */ xLabel?: string; yLabel?: string; /** A least-squares line through the points, with its r² in the footer. */ trend?: boolean; /** Connect successive observations in each group. Missing coordinates break the trail. */ trails?: boolean; /** Numeric time/order field for trails. Defaults to the supplied row order. */ trailOrder?: NumericKey; /** Draws each point as a lit sphere with a soft contact shadow; centers and sizes stay exact. */ depth?: boolean; /** Plot height in pixels, including the axes. Defaults to 260. */ height?: number; /** How the resting headline sums up `y`: `sum` (default), `mean`, or `max`. */ aggregate?: ScatterAggregate; /** Resting headline. Defaults to the `aggregate` of every plotted `y`. */ headline?: number; /** Fractional change shown as a chip, e.g. 0.052 → +5.2%. */ delta?: number; deltaTone?: 'default' | 'inverse' | 'neutral'; /** Static period label, e.g. "Last 30 days". */ range?: string; /** Period select. Each range replaces data, delta, and headline; points glide to their place. */ ranges?: readonly CardRange[]; defaultRange?: string; /** * How the legend lays out: value `tiles` (default), compact `inline` labels, `list` rows, tinted * `pills`, or `bars` that also draw each value against the largest. * False removes the legend without changing the data or marks. */ legend?: CardLegend | false; /** The mark beside each legend label: `square` (default), `dot`, or `line`. */ legendSwatch?: ChartLegendSwatch; /** Number format for `y`: the headline, legend, and y axis. */ valueFormat?: Intl.NumberFormatOptions; /** Number format for `x`, e.g. `{ style: 'currency', currency: 'USD' }`. */ xFormat?: Intl.NumberFormatOptions; locale?: string; formatValue?: (value: number) => string; formatX?: (value: number) => string; /** Any CSS color for the points when there is no `group`. */ color?: string; surface?: ChartSurface; /** A glass tab tucked behind the card's top edge, e.g. a caption, a command, or actions. */ badge?: ReactNode; /** Headline motion: `count` (default), `pop`, `slide`, `roll`, `flow`, or `scramble`. */ numberStyle?: AnimatedNumberVariant; palette?: ChartPalette; loading?: boolean; loadingStyle?: ChartLoadingStyle; /** * What the card shows when the period has no data: `dots` (default), the chart's own `shape`, * your own element such as `No visits yet`, or `null` for nothing. */ empty?: ChartEmptyState; /** `none` turns off decorative motion; reduced-motion users get this automatically. */ motion?: ChartMotion; className?: string; style?: CSSProperties | ChartStyle; } /** Keep input identity and never bridge an unknown reading or an ambiguous duplicate time. */ export declare function scatterTrails(rows: readonly T[]): [T & { x: number; y: number; }, T & { x: number; y: number; }][]; /** * A readable domain for one axis: rounded to the same ticks the axis draws, anchored at zero when * the data starts near it, and never zero-width. */ export declare function scatterDomain(values: readonly number[], ticks?: number): [number, number]; /** Least-squares fit. `null` when fewer than three points or every x is the same. */ export declare function scatterTrend(points: readonly { x: number; y: number; }[]): { slope: number; intercept: number; r2: number; } | null; /** * The part of the line `y = slope·x + intercept` between `x0` and `x1` that stays inside the y * domain, or `null` when it never enters it. */ export declare function clipTrend(fit: { slope: number; intercept: number; }, [x0, x1]: readonly [number, number], [low, high]: readonly [number, number]): [number, number, number, number] | null; /** * A scatter card: one point per row, placed by two measurements and optionally sized by a third * and colored by group. Hovering or stepping through points with the arrow keys reads each one in * the headline, with its position marked on both axes. */ export declare function ScatterChartCard>({ title, header, 'aria-label': ariaLabel, data: suppliedData, x, y, size, sizeLabel, group, label, xLabel, yLabel, trend, trails, trailOrder, depth, height, aggregate, headline: suppliedHeadline, delta: suppliedDelta, deltaTone, range, ranges, defaultRange, valueFormat, legend, legendSwatch, xFormat, locale, formatValue: suppliedFormatValue, formatX: suppliedFormatX, color, surface, badge, numberStyle, palette, loading: pending, loadingStyle, empty: emptyState, motion: motionMode, className, style, }: ScatterChartCardProps): ReactElement;