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

Closed
matwey opened this issue Sep 10, 2023 · 8 comments
Closed

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

matwey opened this issue Sep 10, 2023 · 8 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.

@matwey
Copy link
Author

matwey commented Sep 2, 2024

Just for information, the issue is this there in 3.13.0: https://jsbin.com/wefihonina/1/edit?html

@netil
Copy link
Member

netil commented Sep 3, 2024

@matwey, I'll go over it.

netil pushed a commit to netil/billboard.js that referenced this issue Sep 10, 2024
Fix basic interaction when scale is update with viewBox

Ref naver#3414
@netil netil closed this as completed in 243bf3c Sep 10, 2024
github-actions bot pushed a commit that referenced this issue Oct 11, 2024
# [3.14.0-next.1](3.13.0...3.14.0-next.1) (2024-10-11)

### Bug Fixes

* **api:** Fix to return indexed categories ([55c17c6](55c17c6)), closes [#3365](#3365)
* **axis:** fix error when showing tick only ([705947f](705947f)), closes [#3881](#3881)
* **bar:** Fix stacking bar position on multiple xs ([216da62](216da62)), closes [#3372](#3372)
* **candlestick:** Fix rendering on rotated axis ([17f5058](17f5058)), closes [#3387](#3387)
* **clip:** Fix x axis hide on title.bottom ([beec1bb](beec1bb)), closes [#3364](#3364)
* **event:** Fix interaction with viewBox ([243bf3c](243bf3c)), closes [#3414](#3414)
* **input:** Fix touch/mouse input detection ([3d4392a](3d4392a)), closes [#3854](#3854)
* **option:** Fix inconsistency of padding ([0c1ce81](0c1ce81)), closes [#3426](#3426)
* **shape:** Fix circleY() undefined error ([f4ac3f1](f4ac3f1)), closes [#3388](#3388)
* **size:** Fix legend overflows with padding fit mode ([8357d11](8357d11)), closes [#3872](#3872)
* **subchart, zoom:** Fix returning domain value ([90338ec](90338ec)), closes [#3347](#3347)
* **subchart:** Fix handlebar position ([b897cbb](b897cbb)), closes [#3358](#3358)
* **title:** fix title text center align ([b254a61](b254a61)), closes [#3363](#3363)
* **tooltip:** Fix tooltip.format.value call ([f7d587d](f7d587d)), closes [#3371](#3371)
* **tooltip:** Fix tootip display on tooltip.init ([98e6f8b](98e6f8b)), closes [#3369](#3369)
* **zoom:** Fix unzoom after dynamic data load ([385907e](385907e)), closes [#3878](#3878)

### Features

* **api:** Intent to ship subchart method ([976f04a](976f04a)), closes [#3342](#3342)
* **axis:** Intent to ship axis.evalTextSize ([87048e9](87048e9)), closes [#3889](#3889)
* **interaction:** Intent to ship interaction.onout ([9c668e6](9c668e6)), closes [#3887](#3887)
* **module:** Support dual CJS/ESM package ([437c007](437c007)), closes [#2202](#2202)
* **plugin:** Intent to ship TableView plugin ([215b611](215b611)), closes [#1873](#1873)
* **regions:** Intent to ship regions.label ([b4e3bc2](b4e3bc2)), closes [#3319](#3319)
* **render:** Add forced init option on lazy rendering  ([218ce46](218ce46)), closes [#3106](#3106)
* **resize:** Intent to ship resize.auto='viewBox' ([db21387](db21387)), closes [#3893](#3893)
github-actions bot pushed a commit that referenced this issue Oct 25, 2024
# [3.14.0](3.13.0...3.14.0) (2024-10-25)

### Bug Fixes

* **axis:** fix error when showing tick only ([705947f](705947f)), closes [#3881](#3881)
* **bar:** fix representation of radius for small data ([91b5dca](91b5dca)), closes [#3903](#3903)
* **event:** Fix interaction with viewBox ([243bf3c](243bf3c)), closes [#3414](#3414)
* **input:** Fix touch/mouse input detection ([3d4392a](3d4392a)), closes [#3854](#3854)
* **point:** fix sensitivity error when blank area is clicked ([0060786](0060786)), closes [#3900](#3900)
* **scale:** Fix non-shape's element positioned accurately ([216141b](216141b)), closes [#3907](#3907)
* **size:** Fix legend overflows with padding fit mode ([8357d11](8357d11)), closes [#3872](#3872)
* **zoom:** Fix unzoom after dynamic data load ([385907e](385907e)), closes [#3878](#3878)
* **zoom:** Prevent error for out of range ([6f69e97](6f69e97)), closes [#3895](#3895)

### Features

* **axis:** Intent to ship axis.evalTextSize ([87048e9](87048e9)), closes [#3889](#3889)
* **interaction:** Intent to ship interaction.onout ([9c668e6](9c668e6)), closes [#3887](#3887)
* **legend:** Pass visibility state to legend item's event callback ([ba71911](ba71911)), closes [#3897](#3897)
* **render:** Add forced init option on lazy rendering  ([218ce46](218ce46)), closes [#3106](#3106)
* **resize:** Intent to ship resize.auto='viewBox' ([db21387](db21387)), closes [#3893](#3893)
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