Open zpfdev opened 3 years ago
@zpfdev can you provide an online sample?
You can use this jsfiddle - https://jsfiddle.net/aftjeb0g/2/
@bumbeishvili Unforuantely, I can't seem to reproduce the same thing in jsfiddle. This is my jsfiddle https://jsfiddle.net/2ukpa84c/3/ , and it is working correctly in here. However, when I copy the exact same code to my site, I am still getting the same error. I did a trace, the error indeed happened at var targetel = target || d3.event.target;
of getScreenBBox() function
My app uses Asp.Net webform and this portion of code existed in my .ascx file, which is referenced by another .ascx file, I am not sure if this has to do with it.
The behavior now: The tooltip does show up, but it is located on the top left corner of my web site and I am still getting the same error.
Strange, not sure how I can help, in your place I would remove later d3.event part and would try without it
if I get rid of d3.event.target, I will be getting "targetel is null"
. This is the image https://imgur.com/a/mgIgN7V if that helps, very strange.
I still have the same question: since this library is intended to work with V6, shouldn't d3.event not being a thing anymore? If that's the case, will that be worth to try to downgrade my d3 version to v5? ?
@bumbeishvili I downgraded my D3 version to D3v5 and it worked. I think this may be an issue worth looking into in the future. Thanks for the work tho.
I am running into an
d3.event is undefined
is undefined while trying to create a tooltip. I suspect that it may has to do with thed3.event
ingetScreenBBox()
. because in d3v6, it is replaced withevent.target
.This is how I select my svg and calls the tip function
This is how I draw my map:
How I call tip.show in my mouseOver function:
The problem: I put a console.log in my tip declaration. When my mouse hover over it, it shows the current country name in the console(event.target.id). However, the tooltip never show up due to the error: Uncaught TypeError: d3.event is undefined.