Tooltip not appearing on pie charts when cells re-render
See original GitHub issueI’m trying highlight the selected sector of a pie chart, and the following code works. The issue is that the tooltip won’t appear. If I remove the onMouseEnter
and onMouseLeave
events, then the tooltips show up fine. But of course, I can’t render the selected sector differently in that case. I think there’s an issue with tooltips not appearing when the Cells re-render.
<ResponsiveContainer
width="100%"
height={this.props.height}
>
<PieChart
width={diameter}
height={diameter}
>
<Tooltip/>
<Pie
data={this.props.data}
dataKey="value"
onMouseEnter={(e, activeIndex) => this.setState({ activeIndex }) }
onMouseLeave={() => this.setState({ activeIndex: -1 }) }
>
{
_.map(this.props.data, (entry, i) => (
<Cell
key={`cell-${i}`}
fill={COLORS.CONTRASTING_COLORS[i]}
fillOpacity={this.state.activeIndex === i ? 1 : 0.25}
/>
))
}
</Pie>
</PieChart>
</ResponsiveContainer>
I tried to fix this issue by “actively” controlling the tooltip, but that didn’t work either: https://github.com/recharts/recharts/issues/790
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:17 (3 by maintainers)
Top Results From Across the Web
EVERYTHING you wanted to know about Power BI tooltips
Power BI tooltips can add a lot of context to a visual. Patrick shows you everything you need to know about tooltips in...
Read more >Customizing tooltips in Power BI Desktop
Create custom tooltips for visuals using drag-and-drop. ... The following image shows a tooltip applied to a chart in Power BI Desktop.
Read more >Create Views for Tooltips (Viz in Tooltip)
The Viz in Tooltip in this example shows a message that indicates that some of the data in the target view is not...
Read more >jqPlot Pie Chart Tooltips - jquery
Am I right in thinking that the Hightlighter class in jqPlot does not handle tooltips for the PieRenderer? I've spent quite a while...
Read more >Is there a way to display a popup chart on click o...
I want to popup a chart when a row is clicked on the matrix similar to how a KPI ... But, after refresh,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Figured it out, this works for me:
<Tooltip content={<CustomTooltip />} wrapperStyle={{visibility: this.props.activePieSlice ? 'visible' : 'hidden'}} />
active={true}
does not seem to make any difference to the behaviour of the tooltip at all.Is there a way to always show the tooltip?