NIsham Mahsin
NIsham Mahsin

Reputation: 768

Rechart tooltip issue: shows background elements

I have 3 bar charts one by one. and i have to show custom tooltip but it shows background content when it height is higher than the bar chart. this is the custom tooltip component

const CustomTooltip = ({ active, payload, label }: any) => {
    return (
      <div className="custom-tooltip">
        <p className="label">{`${label} : ${payload[0].value}`}</p>
        <p className="intro">{getIntroOfPage(label)}</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
        <p className="desc">Anything you want can be displayed here.</p>
      </div>
    );
};

see below sandbox for demo. Please guide how to resolve this.

Upvotes: 2

Views: 2417

Answers (2)

Bilal Demir
Bilal Demir

Reputation: 686

This code resolve my problem:

<Tooltip content={CustomTooltip}
         wrapperStyle={{
           borderRadius: '8px',
           padding: '5px',
           backgroundColor: 'rgba(34, 41, 47, 0.1)'
         }}
/>

In css styling don't work for me.

Upvotes: 1

Priyank Kachhela
Priyank Kachhela

Reputation: 2635

According to this github issue you can add zIndex in your tooltip like below:-

<Tooltip content={<CustomTooltip />} wrapperStyle={{ zIndex: 1000 }}/>

Upvotes: 5

Related Questions