question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[xychart] Tooltip does not update when chart position changes

See original GitHub issue

https://user-images.githubusercontent.com/1286001/103257155-2f4eda00-49e4-11eb-8eb9-0d98c701b96e.mov

This behaviour happens when using visx in the react-grid-layout library. When the chart is moved, the x and y positions are not updated and the tooltip is displayed where the chart used to be. After a resize, the since the width prop has changed, the tooltip is rendered correctly.

I can work around this by passing the chart’s X and Y position in as a prop, but I feel like this may be something that the library can solve automatically for me. Thoughts?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
williastercommented, Jan 7, 2021

@RIP21 great suggestion re discussions, it wasn’t available for a while but looks like it is now. Just enabled it, so discuss away! 😎

1reaction
williastercommented, Jan 4, 2021

Ah this is an interesting limitation. The XYChart tooltip is rendered inside of a React Portal and so is absolutely positioned on the page. This was intentional and can be very useful in various circumstances so that it’s not clipped by any parent DOM elements of the chart (see z-index stacking context for more).

It’s implemented with react-use-measure such that it will correct its position upon page scroll, but not if the parent element moves. I’d have to think about robust ways to detect this (open to ideas!), for now I’d suggest @VigneshTrantor 's workaround for force updating with a key change if you know the change happens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[xychart] Tooltip does not update when chart position changes
This behaviour happens when using visx in the react-grid-layout library. When the chart is moved, the x and y positions are not updated...
Read more >
visx/xychart documentation - Airbnb Engineering & Data Science
Series and XYChart events, including tooltip updates, are emitted and handled with through this context.
Read more >
amCharts tooltip is showing only on DateAxis but not ValueAxis
I'm using amCharts and I'm making a XY Chart with multiple series, the tooltip shows ony when ...
Read more >
GaugeChart – amCharts 4 Documentation
Indicates if chart should arrange series tooltips so that they would not overlap. If set to true (default), the chart will adjust vertical...
Read more >
Perspective - XY Chart - Ignition User Manual 8.1
Objects that are the data source for the chart. When configured to show a date or time on the x-axis, the chart expects...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found