import React from 'react'; import { CursorState } from './cursorPlugin'; import type { PlotUtilities } from './renderers/types'; import type { ScaleConfig, SeriesConfig, MarkAnnotation, GenericDataSet, LegendTruncation } from './types'; type Dimensions = { width?: number; height?: number; }; type OnSeriesClick = (field: string, ref: React.Ref) => void; type OnSeriesHover = (field: string | null) => void; export type LegendComponentProps = { cursorState?: CursorState; data: GenericDataSet; plotUtilities?: PlotUtilities; seriesConfig?: SeriesConfig; scaleConfig?: ScaleConfig; hideSeriesValue?: boolean; onSeriesClick: OnSeriesClick; onSeriesHover: OnSeriesHover; seriesDataAccessor?: (seriesIndex: number) => string | number | null; title?: string; reversedOrder?: boolean; fontSize?: number; marks?: MarkAnnotation[]; anchor?: 'right' | 'left' | 'top' | 'bottom'; center?: boolean; largerTiles?: boolean; legendLabels?: string[]; isSeriesCompare?: boolean; legendTruncation?: LegendTruncation; }; export type LegendComponent> = React.ComponentType; export type Legend = { component: LegendComponent; size: Dimensions; anchor: 'right' | 'bottom' | 'left' | 'top'; }; /** * Resets the cached canvas context. Primarily used for testing. * @internal */ export declare const resetMeasureCanvas: () => void; /** * Truncates a label from the start, showing the end with ellipsis at the beginning. * Uses canvas measurement to calculate the optimal truncation point. * @internal */ export declare const truncateStart: (label: string, maxWidth: number, font: string) => string; export declare const SideLegendComponent: LegendComponent<{ width?: number; }>; export declare const BottomLegendComponent: LegendComponent<{ wrap?: boolean; height?: number; }>; type SideLegendFactoryProps = { hideSeriesValue?: boolean; aggregateData?: (number | null)[]; width?: number; fontSize?: number; title?: string; reversedOrder?: boolean; center?: boolean; largerTiles?: boolean; legendTruncation?: LegendTruncation; }; export declare const SideLegendFactory: (props?: SideLegendFactoryProps) => Legend; export declare const LeftLegendFactory: (props?: SideLegendFactoryProps) => Legend; type BottomLegendFactoryProps = { hideSeriesValue?: boolean; aggregateData?: (number | null)[]; wrap?: boolean; fontSize?: number; title?: string; reversedOrder?: boolean; height?: number; center?: boolean; largerTiles?: boolean; legendTruncation?: LegendTruncation; }; export declare const BottomLegendFactory: (props?: BottomLegendFactoryProps) => Legend; export declare const TopLegendFactory: (props?: BottomLegendFactoryProps) => Legend; export declare const BottomLegend: Legend; export declare const TopLegend: Legend; export declare const SideLegend: Legend; export declare const LeftLegend: Legend; export declare const LegendMap: { [key in Legend['anchor']]: Legend; }; export {};