Hover popup is not automatically hiding until I click somewhere

23 views
Skip to first unread message

Kumarasamy R

unread,
Nov 21, 2013, 11:02:56 AM11/21/13
to gf...@googlegroups.com
First of all, This is nice API.. Good job !

I have a small issue with my Bar chart hover. Hover popup is not hiding until I click somewhere. is there any option to auto hide the popup ? thanks for the help.

I have a following code with in the hoverlistner..

public PlotHoverListener buildHoverListner() {

final PopupPanel popup = new PopupPanel();
final Label label = new Label();
popup.add(label);
popup.setAutoHideEnabled(true);    // This works only when I click somewhere.

final PlotHoverListener plotHoverListener = new PlotHoverListener() {

@Override
public void onPlotHover(final Plot plot, final PlotPosition position, final PlotItem item) {
popup.hide();
if (item != null) {
final String text = item.getDataPoint().getX() + "%";

label.setText(text);
popup.setPopupPosition(item.getPageX() + 10, item.getPageY() - 25);
popup.show();
}
else if (item == null || item.getDataPoint().getX() == 0.0) {
popup.hide(); 
}
}
};

return plotHoverListener;
}

Nicolas Morel

unread,
Nov 21, 2013, 11:18:55 AM11/21/13
to gf...@googlegroups.com
Thanks :)

When you add your listener to the plot, do you set the boolean value to false ? If you set true, the listener will be triggered only when you hover a point and item will always be != null.

You could also try to add a MouseOutHandler with plot.addHandler(new MouseOutHandler(){..}, MouseOutEvent.getType()); and hide the popup in it.

Kumarasamy R

unread,
Nov 21, 2013, 12:42:54 PM11/21/13
to gf...@googlegroups.com
Thanks..

I do set the boolean value to true currently. but still the popup is not hiding.... I am going to try MouseOutEvent.

Kumarasamy R

unread,
Nov 21, 2013, 2:23:44 PM11/21/13
to gf...@googlegroups.com
MouseOutHandler works fine. but It has to be added as DomHandler to the plot as follows. 
plot.addDomHandler(....)

Thanks for the help.
Reply all
Reply to author
Forward
0 new messages