Trying to hide the context-menu


« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Joachim on 4th July 2016
Hi,

I've setup up a drill-in chart with a contextmenu in order to go back and show main chart. All this works fine beside the fact that after returning to main-chart the contextmenu is still there. So far I could not find out, how to remove the contextmenu from main-chart (only assignig a "dummy-contextmenu" did work).

Can you help on this?
Thank you!
    
Posted by Richard on 4th July 2016
Hi there,

There's a method available to you that hides the context menu:

RGraph.hideContext();

See if that helps.





Richard

PLEASE READ:

If RGraph has helped you please give your feedback - thanks! You can give your feedback or leave a testimonial by adding a forum post or clicking on the speech bubble icon at the very top right.

But most of all: Please link to the RGraph website (get information on how to do it by clicking on the chain icon at the top right of the page)
Posted by Joachim on 4th July 2016
hi,

tried this already. But this does not help - seems that contextmenu is attached to body-node and does not get cleared with RGraph.hideContext() or RGraph.reset(). If I remove or detach it, e.g. with JQuery(".RGraph_contextmenu").remove(), all contextmenus will be removed (also contextmenues of drill-in charts)
Posted by Richard on 4th July 2016
Hi there,

Yes it does that's the whole point of the RGraph.hideContext() function. There's a HBar chart with a context menu here:

www.rgraph.net/tests/context.html

The code it uses to hide the context menus is triggered when you scroll, using this:

window.onscroll = function ()
{
     RGraph.hideContext();
     //RGraph.hideContextSubmenu(); // Hides just the submenu if any
     //$('.RGraph_contextmenu').hide(); // Your method (which also works)
}






Richard

PLEASE READ:

If RGraph has helped you please give your feedback - thanks! You can give your feedback or leave a testimonial by adding a forum post or clicking on the speech bubble icon at the very top right.

But most of all: Please link to the RGraph website (get information on how to do it by clicking on the chain icon at the top right of the page)
Posted by Joachim on 4th July 2016
hi,

thanks for your response. Maybe you misunderstood the problem. The contextmenu is not displaying or stayes open when main-chart has been drawn. But when I rightclick main-chart the context-menu of drill-in chart is displayed though main-chart has no context-menu defined.

I've circumvented this problem by defining a contextmenu to main-chart to enable options to drill-in via context-menu.
Posted by Richard on 4th July 2016
Hi there,

So now I understand that the issue is that after you switch charts the contextmenu still works, when it shouldn't.

A "contextmenu leak" if you will.

In most browsers this will work:


myChart.canvas.oncontextmenu = null;


But in some (Opera, Safari, Mac FF and maybe Mac Chrome) it likely won't. So let me know if you need to support those.








Richard

PLEASE READ:

If RGraph has helped you please give your feedback - thanks! You can give your feedback or leave a testimonial by adding a forum post or clicking on the speech bubble icon at the very top right.

But most of all: Please link to the RGraph website (get information on how to do it by clicking on the chain icon at the top right of the page)

Add a reply

 




« Back to message list
RGraph on social media