You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
browser zoom and dom zoom will cause mouse position fault in tooltip #15103
in script use document.body.style.zoom to adapt different size of screen. in echarts option add tooltip. use ctrl in browser to zoom your demo or use different size of screen to display your demo
What is expected?
use document.body.style.zoom and zoom browser will not effect mouse hover position in tooltip
What is actually happening?
you will find mouse hover event will trigger wrong part of this chart's tooltip.
Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that it contains a minimum reproducible demo and necessary images to illustrate. Otherwise, our committers will ask you to do so.
A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.
You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to [email protected]. Please attach the issue link if it's a technical question.
If you are interested in the project, you may also subscribe our mailing list.
Okey so for anyone encountering this issue, here is how I fixxed it after a few hours of torture. I have noticed that echarts has an internal rerenderer that triggers on certain conditions. Though, it won't do that when your zoom has already been applied to parent DOM elements.
If your parent element, for example the html element has a predefined zoom of eg. 0.7 set by you, you will have to calculate the inverse and set the zoom on the echart parent div or the echart div itself to trigger a rerender with a valid zoom for it to handle it correctly.
Calculate the inverse with eg.: 1 / 0.7 = 1.42857
Sample:
constelement=document.getElementsByTagName('html')[0];constcomputedStyle=window.getComputedStyle(element);constzoom=computedStyle.getPropertyValue('zoom');this.setState({zoom_amount: 1/zoom})//if zoom = 0.7//then zoom_amount = 1.42857//then give the new zoom, depending on what library you use like below<EchartDivOrParentDivoptions={your_options}style={{zoom: this.state.zoom}}/>//If you give the zoom to the parent div too early without the echart being rendered//then it might pose some scaling issues. I recommend giving the zoom directly the echart element.
Would be great to have this kind of logic naturally included in the echart code but that's one way to handle it. Hope it helps some of you.
Okey so for anyone encountering this issue, here is how I fixxed it after a few hours of torture. I have noticed that echarts has an internal rerenderer that triggers on certain conditions. Though, it won't do that when your zoom has already been applied to parent DOM elements.
If your parent element, for example the html element has a predefined zoom of eg. 0.7 set by you, you will have to calculate the inverse and set the zoom on the echart parent div or the echart div itself to trigger a rerender with a valid zoom for it to handle it correctly.
Calculate the inverse with eg.: 1 / 0.7 = 1.42857
Sample:
constelement=document.getElementsByTagName('html')[0];constcomputedStyle=window.getComputedStyle(element);constzoom=computedStyle.getPropertyValue('zoom');this.setState({zoom_amount: 1/zoom})//if zoom = 0.7//then zoom_amount = 1.42857//then give the new zoom, depending on what library you use like below<EchartDivOrParentDivoptions={your_options}style={{zoom: this.state.zoom}}/>//If you give the zoom to the parent div too early without the echart being rendered//then it might pose some scaling issues. I recommend giving the zoom directly the echart element.
Would be great to have this kind of logic naturally included in the echart code but that's one way to handle it. Hope it helps some of you.
we set 'transform:scale' to it's parents elemet,and then set scale to itself, did that mean,do nothing for it
Activity
echarts-bot commentedon Jun 8, 2021
Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that it contains a minimum reproducible demo and necessary images to illustrate. Otherwise, our committers will ask you to do so.
A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.
You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to [email protected]. Please attach the issue link if it's a technical question.
If you are interested in the project, you may also subscribe our mailing list.
Have a nice day! 🍵
plainheart commentedon Jun 8, 2021
Thanks for the report. Related to #14253, #13615, #13614, #13606, #12645, #11032, #9310, #8386, #8382, #8286, #6674, #6083, #3635, #3511 etc.
I drafted a solution for this issue before, but it may need some discussion. List it in the 5.x milestone.
sheepzheng commentedon Jun 11, 2021
I fixed this problem by setting body transform.
In script add:
then tooltip works right with browser zoom and different sizes of screen
yushouqing commentedon Aug 24, 2021
i have the same issue. browser zoom changed will cause mouse position fault.
wmasfoe commentedon Aug 9, 2022
hello 有解决方案吗?
hauserkristof commentedon Aug 25, 2022
+1
lihaonanzs commentedon Nov 8, 2022
transform后鼠标移入正常,触摸屏移入还存在。
hjmmc commentedon Nov 25, 2022
If you just fix the width, you can try this code, which is basically the same as the zoom effect
tarik56 commentedon May 14, 2023
Okey so for anyone encountering this issue, here is how I fixxed it after a few hours of torture. I have noticed that echarts has an internal rerenderer that triggers on certain conditions. Though, it won't do that when your zoom has already been applied to parent DOM elements.
If your parent element, for example the html element has a predefined zoom of eg. 0.7 set by you, you will have to calculate the inverse and set the zoom on the echart parent div or the echart div itself to trigger a rerender with a valid zoom for it to handle it correctly.
Calculate the inverse with eg.: 1 / 0.7 = 1.42857
Sample:
Would be great to have this kind of logic naturally included in the echart code but that's one way to handle it. Hope it helps some of you.
zystudios commentedon Jun 28, 2024
2024官方还没有解决啊
york-chen commentedon Jul 11, 2024
we set 'transform:scale' to it's parents elemet,and then set scale to itself, did that mean,do nothing for it