import React from 'react'; import uPlot from 'uplot'; import { TimeScale } from './scaleTime'; import type { SeriesInfo } from '../renderers/types'; import { VizTheme } from '../theme'; import type { AdditionalTooltipValues, DataSet, GenericDataSet, MarkAnnotation, NamedFormatters, NumberedFormatters, ScaleConfig, SeriesConfig, TickInterval } from '../types'; import { LocaleInfo } from './formatTimestamp'; export declare const SECOND_TO_MICROSECOND = 1000000; export declare const SECOND_TO_MILLISECOND = 1000; export declare const DAY: number; export declare const EPOCH_SECONDS_MAX_VALUE: number; type TimeSeriesNormalizationResult = { filteredData: GenericDataSet; filteredIndices?: number[]; }; export declare const normalizeTimeValue: (val: string | number | T) => number | T; export declare const normalizeAndFilterTimeSeriesColumns: (data: GenericDataSet) => TimeSeriesNormalizationResult; export declare const filterAdditionalTooltipValues: (values: AdditionalTooltipValues | undefined, retainedRowIndices?: number[]) => AdditionalTooltipValues | undefined; export declare function exists(value: T | undefined | null): value is T; export declare function isNumber(num: number | null | undefined): num is number; /** * Applies opacity to a color string and returns rgba(). * Supports hex (#RGB, #RGBA, #RRGGBB, #RRGGBBAA) and rgb/rgba input. */ export declare const applyOpacityToColor: (inputColor: string, opacity?: number) => string; /** * Centers a 1px tooltip line on the same integer pixel as the annotation icon across all * scaleFactor values. `scaleFactor` is kept in the signature for API compatibility. */ export declare const calculateTooltipLinePosition: (left: number, scaleFactor: number) => number; type AnyFunction = (...args: unknown[]) => unknown; /** * Creates a stable callback for a possibly dynamic callback. * Solution from: https://github.com/facebook/react/issues/16956#issuecomment-536636418 */ export declare function useDynamicCallback(callback?: AnyFunction): AnyFunction | undefined; export declare function useCreateAttachedDivElement(attachTo: HTMLElement | undefined, className: string, dataTestAttribute?: string): HTMLElement; /** * Logs out the properties that change between render cycles. Answers the * "what value - if anything - caused this render to occur" * * @param name * @param props */ export declare const useWhyDidYouUpdate: >(name: string, props: T) => void; /** * Returns the fully formed SeriesConfig for the given field. Merges the `seriesConfig` * properties from the associated `ScaleConfig`, and the explictly defined `SeriesConfig`. */ export declare function getMergedSeriesConfigForField(field: string | undefined, seriesConfigMap?: SeriesConfig, scaleConfigMap?: ScaleConfig): SeriesConfig[keyof SeriesConfig]; /** Create merged config for every defined series */ export declare function getMergedSeriesConfig(seriesConfigMap?: SeriesConfig, scaleConfigMap?: ScaleConfig): SeriesConfig; export declare const formatKibBytes: (bytes: number, decimals?: number) => string; export declare const valueFormatters: NumberedFormatters; export declare const namedFormatters: NamedFormatters; export declare const scaleNamedFormatters: NamedFormatters; export declare const getXAxisResolution: (data: GenericDataSet) => number; export declare const formatValueWithSeriesConfig: (value: number, seriesConfig: SeriesConfig[string], data: GenericDataSet) => React.ReactNode; export declare const formatValueForPlottingWithSeriesConfig: (value: number, seriesConfig: SeriesConfig[string], data: GenericDataSet) => React.ReactNode; export declare const formatValueWithScaleConfig: (value: number, scaleConfig: ScaleConfig[string], xAxisResolution: number) => string; export declare const sortDataSetByTime: (data: DataSet) => { sortedData: DataSet; sortedIndices: number[] | null; }; export declare const findClosest: (arr: number[], target: number) => number | null; export declare const buildColorFunction: (maxDensity: number, theme: VizTheme) => ((value: number) => string); export declare const timeTickFormatter: (tickValue: number, startingScale: TimeScale, decimalPlaces?: number) => string; export declare const filterSplit: (index: number, split: number, splitsPos: number[], u: uPlot) => number | null; export declare const roundToPoT: (value: number, roundFunc: (n: number) => number) => number; export declare const pixelStrToNum: (str: string) => number; export declare const X_AXIS_TIME_OPTIONS: { None: number; '1Min': number; '1Hour': number; '2Hours': number; '6Hours': number; '12Hours': number; '1Day': number; '2Days': number; '8Days': number; }; export declare const markPrefix = "mark-"; export declare const buildSeriesForLegend: (series: SeriesInfo[], reversedOrder?: boolean, marks?: MarkAnnotation[], legendLabels?: string[]) => SeriesInfo[]; export declare const getTickInterval: (tickDiff: number) => TickInterval; export declare const getDefaultExpandedFormatTimeStampLabelParts: (millisecondsEpoch: number, tickInterval: TickInterval, locale: LocaleInfo) => { time: string; day: string; month: string; year: string; }; /** * Creates uPlot hooks for TimeSeriesChart canvas scaling. * * IMPORTANT: This is specific to charts using uPlot's built-in series rendering. * REQUIRES: uPlot's pxRatio option must be set to 1. * * @param scaleFactor - Dashboard zoom factor * @param onReady - Optional callback invoked after canvas setup */ export declare const createCanvasScaleHooks: (scaleFactor: number, onReady?: (u: uPlot) => void) => { init: (u: uPlot) => void; setSize: (u: uPlot) => void; }; export {};