Skip to content
Source
Sign inSign up
TanStack/react-charts

Implement showDatumInTooltip in TooltipOptions to allow hiding certain datums in regular TooltipRenderer. #360

MergedZandor300(GitHub profile, opens in a new tab)merged 2 commits intobeta fromrefs/pull/360/headmerged by tannerlinsley

I wanted to be able to hide datums with value 0 in my chart and couldn't find a way to do this with the current implementation, except write my own TooltipRenderer which I didn't feel like doing.

So this PR will add showDatumInTooltip in TooltipOptions to be able to filter datums that are shown in the regular TooltipRenderer.

@tannerlinsley Could you take a look?

Example usage

<Chart
    options={{
        data,
        primaryAxis,
        secondaryAxes,
        tooltip: {
            showDatumInTooltip: (datum) => {
                return datum.originalDatum.value !== 0;
            }
        }
    }}
/>
    1. tannerlinsley merged this582bc33

    2. tannerlinsley closed this

    3. :tada: This PR is included in version 3.0.0-beta.57 :tada:

      The release is available on:

      Your semantic-release bot :package::rocket:

    4. tannerlinsley added labelsreleased on @beta

Sign in to join this conversation.