Replies: 1 comment
|
const {
tooltipOpen: pinOpen,
tooltipData: pinData,
tooltipLeft: pinLeft,
tooltipTop: pinTop,
showTooltip: showPin,
hideTooltip: hidePin,
} = useTooltip<{ datum: MyDatum }>()
<LineSeries
dataKey="Line 1"
data={data}
xAccessor={xAccessor}
yAccessor={yAccessor}
onPointerUp={({ datum, svgPoint }) => {
showPin({ tooltipData: { datum }, tooltipLeft: svgPoint.x, tooltipTop: svgPoint.y })
}}
/>
{pinOpen && (
<TooltipWithBounds left={pinLeft} top={pinTop} style={{ ...defaultStyles, pointerEvents: 'auto' }}>
<YourInteractiveContent datum={pinData!.datum} onClose={hidePin} />
</TooltipWithBounds>
)}Because this second tooltip has its own state, it doesn't get overwritten by the hover tooltip's continuous updates, and since it's a normal |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I need to implement a tooltip that is pinned to a specific data point when clicked. This is done to have a tooltip with interactive content inside for digging deeper into data. I am attaching a Loom to make this visual -https://www.loom.com/share/525ce376ab624ce78dd55d70b10ca1f6
I have a working implementation, but I am curious to hear if there is a better way to do this.


Also sharing an image below showing my current implementation - architecture and provider
All reactions