Skip to content
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

Support positioning relative to marks #200

Open
domoritz opened this issue Apr 25, 2018 · 13 comments
Open

Support positioning relative to marks #200

domoritz opened this issue Apr 25, 2018 · 13 comments

Comments

@domoritz
Copy link
Member

domoritz commented Apr 25, 2018

  • Support both positionings relative to mark and to the cursor.
  • Define relative offsets for both cases.
  • For positioning relative to marks, let us define where the tooltip is (top, left, right, bottom).
  • For positioning relative to marks, we should have a maximum distance after which we position the tooltip relative to the cursor.

@nyurik implemented something like this in kibana. https://github.com/elastic/kibana/pull/17632/files

@nyurik
Copy link
Member

nyurik commented Apr 27, 2018

Here's the implementation using our positioning library - see construction of the clientRect https://github.com/nyurik/kibana/blob/c81fff3671cf40b86b1a368115b3852c0f9d8af3/src/core_plugins/vega/public/vega_view/vega_tooltip.js#L55 (note that it supports both the x,y mouse and mark. This is important because some marks may be too big to be used for centering)

@pelotom
Copy link

pelotom commented Apr 27, 2018

Does this issue cover restoring the ability to have the tooltip follow the mouse as it moves? Currently it doesn't seem possible to do that with a view.tooltip(...) handler, because it only gets invoked once on entry and not when moving the mouse around on top of a mark element.

@nyurik
Copy link
Member

nyurik commented Apr 27, 2018

@pelotom no, that would be a different issue with Vega itself. This tooltip opens up only when Vega tells it to open - basically it is a simple replacement for the built-in (drawn on canvas) tooltip.

@domoritz
Copy link
Member Author

@jheer mentioned that the next version of Vega will fire tooltip events as the cursor moves. With that, we will get the old behavior back (which I agree is preferred).

@pelotom
Copy link

pelotom commented Apr 27, 2018

Ah, I just filed an issue for it: vega/vega#1263. Good to hear it's already being planned!

@nyurik
Copy link
Member

nyurik commented Apr 28, 2018

Should it be up to the handler to determine if the last value is the same object as the current one? It might get tricky if the data itself changes inside the object. I wouldn't want to keep flashing the tooltip if the value is not changing.

@domoritz
Copy link
Member Author

domoritz commented May 8, 2018

Vega 4rc is out and so we can fix this now using getItemBoundingClientRect.

@ifokeev
Copy link

ifokeev commented Oct 13, 2018

any updates here?

@domoritz
Copy link
Member Author

I’d love to review a PR. It should be fairly straightforward to implement.

@bkfarnsworth
Copy link

It would also be great if this allowed clicking on a link inside the tooltip. Right now you can't have a link inside vega tooltips because they will immediately reposition if you try to move the mouse to click on it.

tejesh0 pushed a commit to tejesh0/vega-tooltip that referenced this issue May 14, 2019
@Shians
Copy link

Shians commented Jul 23, 2020

I'd like to pop up a tooltip locked to the mark without following the cursor. Is this possible right now?

@domoritz
Copy link
Member Author

That's what this issue is about. Not, it's not implemented yet.

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

No branches or pull requests

6 participants