Tooltip options
ChartTooltipContext, TooltipOptions, TooltipRendererParams, TooltipStyleOptions: generated from the source of active-charts.
Exported by @workspace/. Generated from the package source; part of the index of every export.
Types#
What a tooltip knows about the axes it points into: the x axis's type and temporal semantic, the y axis's type, the host's value and the series' value semantics, so a custom renderer formats a value exactly as the axis beneath it does. Built from the chart's geometry (one axis truth, no second derivation) and passed as Tooltip and Tooltip; absent on the standalone families, which have no Cartesian axes. Kept narrow: only fields with a consumer.
interface ChartTooltipContext {
readonly xAxisType: AxisType;
readonly xTemporalSemantic?: TemporalSemantic;
readonly yAxisType: AxisType;
readonly valueFormatter?: (
value: number,
params?: TooltipRendererParams,
) => string;
readonly valueSemantics?: ChartValueSemantics;
}interface TooltipOptions {
enabled?: boolean;
mode?: 'single' | 'shared' | 'split';
renderer?: (params: TooltipRendererParams) => ReactNode;
valueFormatter?: (value: number, params?: TooltipRendererParams) => string;
snapDistance?: number;
pin?: boolean;
style?: TooltipStyleOptions;
}Context object for tooltip-renderer callbacks, in three groups:
point— per-datum + per-series info (datum, x/yKey, x/yValue, seriesName, color, scatter size)context— tooltip context (axis info, formatter defaults) from the chart geometry- mode-specific data (
entriesfor shared mode) and pipeline context (group)Meta
interface TooltipRendererParams {
point: {
datum: Record<string, unknown>;
xKey: string;
yKey: string;
xValue: Date | number | string;
yValue: number;
seriesName: string;
color: string;
sizeValue?: number;
sizeKey?: string;
errorBounds?: TooltipErrorBounds;
xErrorBounds?: TooltipErrorBounds;
zone?: string;
};
context?: ChartTooltipContext;
entries?: Array<{
seriesName: string;
color: string;
yKey: string;
yValue: number | null;
errorBounds?: TooltipErrorBounds;
zone?: string;
}>;
groupMeta?: GroupMeta;
}Visual styling overrides for the tooltip surface. Each field falls back to the active theme value (ACTIVE_) when omitted.
interface TooltipStyleOptions {
background?: string;
borderColor?: string;
borderRadius?: number;
boxShadow?: string;
fontSize?: number;
fontFamily?: string;
padding?: Padding;
color?: string;
}