reactjsd3.jsrecharts

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.


Solution

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

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