-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Trigger event when mouse hover over chart's bar #498
Comments
@macdevign Try adding this setting: chart.getStyler().setToolTipsEnabled(true); If you still have a problem, please upload all your codes for the problem as an attachment, such as Demo or test cases or the whole project, and so on,to help you analyze this problem. Thank you. |
Does setToolTipsEnabled to true allow to listen to mouse's hover to chart's bar and how do I accomplish that (eg something like toolTip.addSelectionListener ?) |
I guess what you could do is something like
and in your event handlers, use
to convert the screen coords to the graph coords so you know which graph element to show info for. |
Hi, which version of XChart has these methods (chart.getChartXFromCoordinate() and chart.getChartYFromCoordinate())? I am using 3.8.0 and my IDE complains about those methods not existing. I pulled the master branch for XChart and did a recursive grep and it didn't find them either. Thanks for any help. I'm basically looking for a click handler and a way to identify the pie slice a user clicked on. |
That was on 3.6.7-Snapshot, which was the bleeding edge version when I did something similar last November. Seems like it was removed on this commit: aa13f6c#diff-9013d15fe5f4684f20473ca036c5bd33d67ba15a015e20da5f20be05337d6343 but the diff looks like you can probably get the X/Y axis, and get the coordinate from there. Not sure if that works with a pie chart though, as I used the XYChart in my code. |
Thanks for the info. Hm, you wouldn't happen to know if there's an API for querying the currently selected tooltip, would you? I just realized that if I had that in the Panel's MouseListener.mousePressed handler, if I could query that and would have the information I'm after! The PieChart definitely highlights the slice as the mouse cursor moves over it (when setTooltipsEnabled(true) that is). |
I note that currently cursor is able to show data detail as mouse hover over chart's bar, but is there a way to listen to event whenever mouse hover over chart's bar ? Basically I want to show custom detail in custom UI whenever mouse hover over chart's bar, is that possible , and if so, how to do that ?
The text was updated successfully, but these errors were encountered: