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

Tooltip is broken when <svg> is supplied with viewBox #3414

Open
matwey opened this issue Sep 10, 2023 · 6 comments
Open

Tooltip is broken when <svg> is supplied with viewBox #3414

matwey opened this issue Sep 10, 2023 · 6 comments

Comments

@matwey
Copy link

matwey commented Sep 10, 2023

Description

I am using billboard.js 3.9.4 and see the tooltip issue when I create the plot as the following:

      var viewbox_chart = bb.generate({
        data: { columns: columns, types: types },
        resize: { auto: false },
        size: { width: 320, height: 240},
        svg: {classname: "img-fluid w-100"},
        bindto: "#viewbox"
      });
      viewbox_chart.$.svg.attr("viewBox", "0 0 320 240");

Please note, that I attach viewBox attribute to the <svg> tag. This is done intentionally to achieve scaling behavior I want.
When viewBox is set then the plot is scaled as a whole. Please mind the difference in the example below.
I am not sure if this scenario is supported or not, but everything works fine except the tooltip. The tooltip does not appear at the mouse positions where it should and appears where it should not.

Steps to check or reproduce

Minimal example: https://jsbin.com/luzohuvita/edit?html,output

@netil
Copy link
Member

netil commented Sep 11, 2023

Hi @matwey, the toolip positon's coordinate comes from the mouse event coordinate and it uses d3-pointer.
Try using tooltip.position option to set different position coordinate in this case.

@matwey
Copy link
Author

matwey commented Sep 11, 2023

Thanks. I am afraid tooltip.position won't help here. Because the issue is that the tooltip is not activated when mouse pointer is pointing to data point, instead it is activated when the pointer is pointing to some empty space.

@matwey
Copy link
Author

matwey commented Nov 8, 2023

It is still an issue for 3.10.3.

@matwey
Copy link
Author

matwey commented Feb 22, 2024

The issue is still persists in 3.11.1

@netil
Copy link
Member

netil commented Feb 22, 2024

@matwey, would you like contribute fixing this?

@matwey
Copy link
Author

matwey commented Feb 22, 2024

I would but I am not sure how. I mean I don't understand what is the core reason for this behavior.

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

2 participants