import UPlot, { Options as UPlotOptions, AlignedData, Series, SyncPubSub } from 'uplot'; import LegendPlugin from './plugins/legend/legend'; import { TooltipPlugin } from './plugins/tooltip/tooltip'; import cursorPlugin from './plugins/cursor/cursor'; import { PlotLinesPlugin } from './plugins/plotLines/plotLines'; import { YagrConfig, MinimalValidConfig, InternalYargHooks } from './types'; import ColorParser from './utils/colors'; import ThemedDefaults from './defaults'; import i18n from './locale'; import { CreateUplotOptionsMixin } from './mixins/create-options'; import { TransformSeriesMixin } from './mixins/transform-series'; import { DynamicUpdatesMixin } from './mixins/dynamic-updates'; import { BatchMixin } from './mixins/batch-updates'; export interface YagrEvent { chart: Yagr; meta: YagrMeta; } export type YagrMeta = { renderTime: number; processTime: number; initTime: number; }; type CachedProps = { width: number; height: number; }; export interface YagrState { isEmptyDataSet: boolean; isMouseOver: boolean; stage: 'config' | 'processing' | 'uplot' | 'render' | 'listen' | 'dispose'; inBatch?: boolean; y2uIdx: Record; subscribed: boolean; } declare class Yagr { id: string; options: UPlotOptions; uplot: UPlot; root: HTMLElement; series: AlignedData; config: YagrConfig; resizeOb?: ResizeObserver; canvas: HTMLCanvasElement; plugins: { tooltip?: ReturnType; plotLines?: ReturnType; cursor?: ReturnType; legend?: LegendPlugin; } & Partial; } : {}>; state: YagrState; utils: { colors: ColorParser; sync?: SyncPubSub; theme: ThemedDefaults; i18n: ReturnType; }; get isEmpty(): boolean; protected _startTime: number; protected _meta: Partial; /** Create uPlot options methods */ protected createUplotOptions: CreateUplotOptionsMixin['createUplotOptions']; protected transformSeries: TransformSeriesMixin['transformSeries']; protected _uHooks: Record void>; /** Dynamic update methods */ setTheme: DynamicUpdatesMixin['setTheme']; setLocale: DynamicUpdatesMixin['setLocale']; setAxes: DynamicUpdatesMixin['setAxes']; setSeries: DynamicUpdatesMixin['setSeries']; setVisible: DynamicUpdatesMixin['setVisible']; setFocus: DynamicUpdatesMixin['setFocus']; setScales: DynamicUpdatesMixin['setScales']; setTitle: DynamicUpdatesMixin['setTitle']; setConfig: DynamicUpdatesMixin['setConfig']; /** Batch update methods */ batch: BatchMixin['batch']; protected fullUpdate: BatchMixin['fullUpdate']; protected _batch: BatchMixin['_batch']; protected _cache: CachedProps; /** Mixin methods */ private initMixins; constructor(root: HTMLElement, pConfig: TConfig); /** * Redraws Yagr instance by given options. */ redraw(series?: boolean, axes?: boolean): void; /** * Get current scale ranges (min/max values) * @param scaleName - Optional scale name. If not provided, returns all scales * @returns Object with min/max values for each scale */ getScales(scaleName?: string): Record; /** * Get uPlot's Series from series id */ getSeriesById(id: string): Series; getSerieLegendColor(serie: Series): string; dispose(): void; toDataUrl(): string; subscribe(): void; unsubscribe(): void; protected init: () => void; protected execHooks: (hookName: T, ...args: Parameters[T][0]>) => void; protected inStage(stage: YagrState['stage'], fn?: () => void): this; protected initRender: (u: uPlot, done: Function) => void; protected initTitle(): void; private onError; private trackMouse; private onResize; get clientHeight(): number; reflow(redraw?: boolean): void; } export default Yagr;