File tree 3 files changed +6
-2
lines changed
3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export function defaultTooltip<TDatum>(
41
41
arrowPadding : options . arrowPadding ?? 7 ,
42
42
// anchor: options.anchor ?? 'closest',
43
43
render : options . render ?? TooltipRenderer ,
44
+ showDatumInTooltip : options . showDatumInTooltip ?? ( ( ) => true ) ,
44
45
}
45
46
}
46
47
Original file line number Diff line number Diff line change @@ -54,7 +54,9 @@ function TooltipRenderer<TDatum>(props: TooltipRendererProps<TDatum>) {
54
54
55
55
const { tooltip, dark } = props . getOptions ( )
56
56
57
- const groupDatums = props . focusedDatum ?. tooltipGroup ?? [ ]
57
+ const groupDatums = ( props . focusedDatum ?. tooltipGroup ?? [ ] ) . filter (
58
+ datum => tooltip . showDatumInTooltip ?.( datum ) ?? true
59
+ )
58
60
59
61
const resolvedShowCount = showCount % 2 === 0 ? showCount : showCount + 1
60
62
const length = groupDatums . length
Original file line number Diff line number Diff line change @@ -124,7 +124,8 @@ export type TooltipOptions<TDatum> = {
124
124
render ?: ( props : TooltipRendererProps < TDatum > ) => React . ReactNode
125
125
// formatSecondary?: (d: unknown) => string | number
126
126
// formatTertiary?: (d: unknown) => string | number
127
- invert ?: boolean
127
+ invert ?: boolean ,
128
+ showDatumInTooltip ?: ( datum : Datum < TDatum > ) => boolean
128
129
}
129
130
130
131
export type ResolvedTooltipOptions < TDatum > = TSTB . Object . Required <
You can’t perform that action at this time.
0 commit comments