import { Theme } from '@mui/material'; import { EChartsOption } from 'echarts'; import { WidgetSeries } from '../types'; /** A single point — `[x, y]` tuple. */ export type ScatterplotDatum = readonly [number, number]; /** Scatterplot widget data — array of series, each a list of `[x, y]` tuples. */ export type ScatterplotWidgetData = readonly (readonly ScatterplotDatum[])[]; /** Inputs to the structural-only {@link scatterplotOptions} builder. */ export interface ScatterplotOptionsInput { theme: Theme; /** Optional formatter for x-axis values. */ xFormatter?: (value: number) => string; /** Optional formatter for y-axis values. */ yFormatter?: (value: number) => string; } /** * Combined inputs for the scatterplot option factory creator. Carries * everything the widget needs across BOTH phases — the structural-build * (`theme`, `xFormatter`, `yFormatter`, `optionsOverride`) AND the data * merge (`series`, `symbolSize`, `selection`). */ export interface ScatterplotOptionFactoryInput { theme: Theme; /** * Optional x-axis value formatter. Drives the structural x-axis * label and the reactive tooltip path: when RelativeData overrides * `state.formatter` (the y formatter) the merger rebuilds the tooltip * and reads `xFormatter` to render coordinates correctly. xFormatter * itself isn't relativized — x stays raw. */ xFormatter?: (value: number) => string; /** Optional formatter for y-axis values (structural baseline). */ yFormatter?: (value: number) => string; /** * Per-series metadata — drives the legend, `series[i].name`, and * (when `color` is set) a per-series colour override on the points. */ series?: readonly WidgetSeries[]; /** Symbol size in px (default `8`). */ symbolSize?: number; /** * Selected point keys, one per `${seriesIndex}:${dataIndex}` pair. Points * not in this list render dimmed (`itemStyle.opacity: 0.15`). `null`/empty * means no selection. */ selection?: readonly string[] | null; /** * Consumer-supplied partial option merged into the structural option at * structural-build time. Lets stories override pieces of the theme-aware * base without forking the structural builder. */ optionsOverride?: Partial; } export type ScatterplotEChartsOption = EChartsOption;