File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Expand file tree Collapse file tree 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>(
4141 arrowPadding : options . arrowPadding ?? 7 ,
4242 // anchor: options.anchor ?? 'closest',
4343 render : options . render ?? TooltipRenderer ,
44+ showDatumInTooltip : options . showDatumInTooltip ?? ( ( ) => true ) ,
4445 }
4546}
4647
Original file line number Diff line number Diff line change @@ -54,7 +54,9 @@ function TooltipRenderer<TDatum>(props: TooltipRendererProps<TDatum>) {
5454
5555 const { tooltip, dark } = props . getOptions ( )
5656
57- const groupDatums = props . focusedDatum ?. tooltipGroup ?? [ ]
57+ const groupDatums = ( props . focusedDatum ?. tooltipGroup ?? [ ] ) . filter (
58+ datum => tooltip . showDatumInTooltip ?.( datum ) ?? true
59+ )
5860
5961 const resolvedShowCount = showCount % 2 === 0 ? showCount : showCount + 1
6062 const length = groupDatums . length
Original file line number Diff line number Diff line change @@ -124,7 +124,8 @@ export type TooltipOptions<TDatum> = {
124124 render ?: ( props : TooltipRendererProps < TDatum > ) => React . ReactNode
125125 // formatSecondary?: (d: unknown) => string | number
126126 // formatTertiary?: (d: unknown) => string | number
127- invert ?: boolean
127+ invert ?: boolean ,
128+ showDatumInTooltip ?: ( datum : Datum < TDatum > ) => boolean
128129}
129130
130131export type ResolvedTooltipOptions < TDatum > = TSTB . Object . Required <
You can’t perform that action at this time.
0 commit comments