import { PeakMeasurement, Bounds } from '../../../types'; import { AnimationEngine } from '../../../core/animation'; export interface PeakToolOptions { /** Line color for measurement (default: '#ff6b6b') */ lineColor?: string; /** Line width in pixels (default: 2) */ lineWidth?: number; /** Show labels at measurement points (default: true) */ showLabels?: boolean; /** Label font size (default: 12) */ labelFontSize?: number; /** Label background color (default: 'rgba(0,0,0,0.8)') */ labelBackground?: string; /** Label text color (default: '#ffffff') */ labelColor?: string; /** Show peak values inline (default: true) */ showPeak?: boolean; /** Number precision for values (default: 4) */ precision?: number; /** Custom CSS class for overlay elements */ className?: string; /** Number of points to use for baseline regression (default: 10) */ baselineWindow?: number; /** Area fill color (default: 'rgba(255, 107, 107, 0.3)') */ areaFill?: string; /** Point highlight size when hovering (default: 10) */ highlightSize?: number; /** Point highlight color (default: '#00f2ff') */ highlightColor?: string; /** Snap radius in pixels for detecting nearby points (default: 20) */ snapRadius?: number; } /** Data point with series information */ export interface DataPoint { x: number; y: number; seriesId: string; yAxisId?: string; index: number; pixelX: number; pixelY: number; } export interface PeakToolState { /** Whether the tool is enabled */ enabled: boolean; /** Selection state: 'idle' | 'waitingSecond' | 'complete' */ selectionState: 'idle' | 'waitingSecond' | 'complete'; /** First selected point */ point1: DataPoint | null; /** Second selected point */ point2: DataPoint | null; /** Currently hovered point (for highlighting) */ hoveredPoint: DataPoint | null; /** Last completed measurement */ lastMeasurement: PeakMeasurement | null; } export interface SeriesData { id: string; x: Float32Array | Float64Array | number[]; y: Float32Array | Float64Array | number[]; yAxisId?: string; } export interface PeakToolContext { container: HTMLElement; getPlotArea: () => { x: number; y: number; width: number; height: number; }; getViewBounds: () => Bounds; getYBounds?: (yAxisId?: string) => { yMin: number; yMax: number; }; requestRender: () => void; getSeries?: () => SeriesData[]; onMeasure?: (measurement: PeakMeasurement) => void; animationEngine?: AnimationEngine; } export declare class PeakTool { private ctx; private options; private state; private overlayCanvas; private overlayCtx; private labelOffset; private isDraggingLabel; private labelBounds; private dragStart; private crosshairPosition; private boundMouseMove; private boundClick; private boundKeyDown; private boundMouseDown; private boundMouseUp; private boundResize; constructor(context: PeakToolContext, options?: PeakToolOptions); /** * Enable the peak measurement tool */ enable(): void; /** * Disable the peak measurement tool */ disable(): void; /** * Toggle the tool on/off */ toggle(): void; /** * Check if tool is enabled */ isEnabled(): boolean; /** * Get the current state */ getState(): PeakToolState; /** * Get the last completed measurement */ getMeasurement(): PeakMeasurement | null; /** * Clear the current measurement */ clear(): void; /** * Destroy the tool and cleanup */ destroy(): void; /** * Recalculate measurements (useful if data changes) */ recalculate(): void; private createOverlay; private resizeOverlay; private destroyOverlay; private attachListeners; private detachListeners; private handleMouseMove; private handleLabelMouseDown; private handleLabelMouseUp; private handleClick; private handleKeyDown; private findNearestPoint; private calculateMeasurement; renderOverlay(): void; private drawPointTooltip; private drawPointLabel; private drawMeasurementLabel; private drawStatusIndicator; private roundRect; private formatValue; } /** * Create a peak tool for a chart context */ export declare function createPeakTool(context: PeakToolContext, options?: PeakToolOptions): PeakTool;