-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Series data points are not reachable on mouse hover in line and area charts with Firefox #469
Comments
+1 |
I think I have the same issue. When I move mouse over the tooltip area it always shows tooltip of an element that has lower x coordinate. Works perfectly in chromium browser. I think the issue might be in https://github.com/swimlane/ngx-charts/blob/master/src/common/tooltip-area.component.ts#L148. According to https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetX the offsetX property is experimental and should not be used in production. |
Error is still present in Firefox 57.0 (Quantum). |
Does upgrading to ngx-charts 7.0.1 fix this? |
@marjan-georgiev Do I need to upgrade to ng5 to use ngx-charts 7.0.1? Or is it compatible to ng4.4.6?
|
Yes, you need angular 5 for ngx-charts v7. |
@marjan-georgiev unfortunately I can't upgrade to ng5 yet because of a nasty bug in ng-cli 1.5.x. However I've tested the ngx-charts v7.0.1 line chart on the demo page and the Firefox problem is still there. |
I tried ngx-charts v7.0.1 on angular 5 and Firefox 57(Quantum) but the problem is still there also. Is there any workaround for this problem? |
As @cesco69 said, this issue still exists (despite v7.0.1 and new Firefox). @marjan-georgiev could you give us some pointers on how to solve this? |
The Problem still exists with latest version of ngx-charts (v7.0.1) and angular 5. |
Same problem exists for IE 11 also |
Same glitch in Edge Browser 16.16299 on Windows 10 Pro as well |
Okay so for anyone that got stuck here. I just examined the code and came to the conclusion that as @weequ mentioned offsetX in tooltip-area.component.ts could be the culprit here. Examining the xPos on the mouseMove event, I came to notice that Firefox/IE gave me back entirely different values for event.offsetX. Which led to xPositions that were below zero. I'm talking about this rule exactly:
So I did some searching and came around this issue:
Okay so it seems I was a little bit to quick there. If I have a solid fix I will post it over here. |
This pull request fixes swimlane#469 where data points aren't reachable through the mouse over event. Since event.offsetX isn't fully supported in all browsers (i.e. it gives different values on IE, Firefox then in Chrome for example), replacing event.offsetX by event.pageX - event.target.getBoundingClientRect().left gives a better cross browser solution.
So apparently in Chrome event.pageX - event.target.getBoundingClientRect().left gives me a different value then event.offsetX as where as in Firefox these two result in exactly the same numbers. The difference between the numbers in Chrome is compensated by subtracting this.dims.xOffset. To make this work in both browsers we could just use I'm going to submit this as a pull request if i've tested the outcome in IE and Safari as well. |
@Luukschoen did it work? |
@CramericaIndustries yes it did. I will create a PR in 1, 2, 3 .. |
Solves swimlane#469. event.pageX - event.target.getBoundingClientRect().left gives me a different value then event.offsetX as where as in Firefox and IE these two result in exactly the same numbers. The difference between the numbers in Chrome is compensated by subtracting this.dims.xOffset. To make this work in all browsers we could just use const xPos = event.pageX - event.target.getBoundingClientRect().left; instead of using offsetX and subtracting it with dims.xOffset.
@marjan-georgiev will @Luukschoens fix be included in the next release? |
If somebody wants to apply the patch manually until the new release is out: |
Solves #469. event.pageX - event.target.getBoundingClientRect().left gives me a different value then event.offsetX as where as in Firefox and IE these two result in exactly the same numbers. The difference between the numbers in Chrome is compensated by subtracting this.dims.xOffset. To make this work in all browsers we could just use const xPos = event.pageX - event.target.getBoundingClientRect().left; instead of using offsetX and subtracting it with dims.xOffset.
This was added and released in 7.1.0 |
I'm submitting a ... (check one with "x")
Current behavior
I try to move the mouse cursor over a data point on a line- or area-chart with firefox. But the series-group-tooltip always overlap the data-point I want to reach.
Expected behavior
All data points should be reachable with the mouse cursor.
Reproduction of the problem
Move the mouse cursor to any data point with firefox in this plunker:
https://plnkr.co/edit/WTqX5jmYzCmjZI16gkg9?p=preview
Please tell us about your environment:
Windows 7, IntelliJ
Browser: Firefox 54.0.1
Language: all
The text was updated successfully, but these errors were encountered: