// SPDX-License-Identifier: MIT /** A single [x, y] point. */ export type XYPoint = [number, number]; /** A labeled series of points. This is shown as a single line. */ export interface Series { data: XYPoint[]; label: string; } /** All series passed to the graph. */ export type SeriesData = Series[]; /** Max ticks to render on each axis. */ export interface MaxTicks { /** @default 15 */ x?: number; /** @default 10 */ y?: number; } /** Axis labels. */ export interface AxisLabels { /** @default "X" */ x?: string; /** @default "Y" */ y?: string; } /** Configuration for drawGraph. */ export interface DrawGraphConfig { /** Data series to render. */ data: SeriesData; /** SVG viewbox width in pixels. @default 800 */ width?: number; /** SVG viewbox height in pixels. @default 500 */ height?: number; /** * Line colors for each series. * The default is auto-generated by evenly spacing the hues. */ lineColors?: string[]; /** Max tick counts per axis. @default { x: 15, y: 10 } */ maxTicks?: MaxTicks; /** * Called when a selection is made on the x-axis. * By default this just takes a slice of the `data` field. */ loadData?: (minX: number, maxX: number) => Promise; /** Axis labels. @default { x: "X", y: "Y" } */ axisLabels?: AxisLabels; /** Click event handler * @param nearestPoints - The nearest point matched for each series of data provided * @param x - The exact x value clicked on, whether there was a datapoint there or not */ onClick?: (event: PointerEvent, x: number, nearestPoints: XYPoint[]), } /** * Draws a graph for the provided configuration. * Returns nothing. */ export declare const drawGraph: (config: DrawGraphConfig) => void;