New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip Position is wrong if useMaxWidth = false and you scroll #542

Open
renierr opened this Issue Jun 14, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@renierr

renierr commented Jun 14, 2017

if you set useMaxWidth to false and render a large graph where you able to scoll.
The Tooltip position is wronmg if you scroll left/right or up/down

I solved this by setting the CSS style for tooltip to 'fixed' and changed the added scroll top position in JS

from:
tooltipElem.html(el.attr('title')).style('left', rect.left + (rect.right - rect.left) / 2 + 'px').style('top', rect.top - 14 + document.body.scrollTop + 'px');

to:
tooltipElem.html(el.attr('title')).style('left', rect.left + (rect.right - rect.left) / 2 + 'px').style('top', rect.top - 14 + 'px');

@ziyiwang

This comment has been minimized.

ziyiwang commented Oct 5, 2017

Hi
the above didnt work for me

changing to this worked

tooltipElem.html(el.attr('title')).style('left', rect.left + (rect.right - rect.left) / 2 + 'px').style('top', rect.top - 14 + document.scrollingElement.scrollTop + 'px');

@vnijs

This comment has been minimized.

vnijs commented Dec 30, 2017

@ziyiwang's response seems to address the issue with tooltip placement after zooming (#388) and scrolling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment